Skip to content

Commit

Permalink
Prevent an overwriting bug in SM
Browse files Browse the repository at this point in the history
- SM (Obstacle only?) has a bug where a MT Clip X triggered also triggers the MT Clip X-1 previously triggered (if it exists) at the same time. We now prevent any position overwrite for the quests to work.
- Small update of the tokens table structure so Y positions can be negative as they're underground.
  • Loading branch information
Harest committed Dec 2, 2019
1 parent 7573d49 commit ab72911
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,11 @@
{
if (TextLib::ToLowerCase(RemoveToken) == TextLib::ToLowerCase(Pe_LocalTokensIds[G_QuestId][i]))
{
if (DebugMode) log("Quest " ^ TextLib::ToText(G_QuestId) ^ " - Token " ^ Pe_LocalTokensIds[G_QuestId][i] ^ " collected");
if (Per_LocalTokensCollected[G_QuestId][i]) {
if (DebugMode) log("Quest " ^ TextLib::ToText(G_QuestId) ^ " - Token " ^ Pe_LocalTokensIds[G_QuestId][i] ^ " already collected, skipping - Position: " ^ TextLib::ToText(GUIPlayer.Position));
break;
}
if (DebugMode) log("Quest " ^ TextLib::ToText(G_QuestId) ^ " - Token " ^ Pe_LocalTokensIds[G_QuestId][i] ^ " collected - Position: " ^ TextLib::ToText(GUIPlayer.Position));
Per_LocalTokensCollected[G_QuestId][i] = True;
Pe_PlayerPos[G_QuestId][i] = TextLib::ToText(GUIPlayer.Position);
break;
Expand Down
4 changes: 4 additions & 0 deletions _private/migrating_v1010_to_v1012.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE `tokens` CHANGE `min_pos_y` `min_pos_y` SMALLINT(5) NULL DEFAULT NULL, CHANGE `max_pos_y` `max_pos_y` SMALLINT(5) NULL DEFAULT NULL;
ALTER TABLE `tokens` CHANGE `quest_id` `quest_id` SMALLINT(5) UNSIGNED NOT NULL;

-- Underground mapping leads to negative Y positions, need to remove that unsigned attribute on min/max y pos
8 changes: 4 additions & 4 deletions _private/tm2ml_sidequests.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost
-- Généré le : Dim 24 nov. 2019 à 20:22
-- Généré le : Dim 01 déc. 2019 à 22:14
-- Version du serveur : 10.3.17-MariaDB-0+deb10u1-log
-- Version de PHP : 7.3.11-1~deb10u1

Expand Down Expand Up @@ -69,12 +69,12 @@ CREATE TABLE `quests` (

CREATE TABLE `tokens` (
`id` mediumint(8) UNSIGNED NOT NULL,
`quest_id` tinyint(3) UNSIGNED NOT NULL,
`quest_id` smallint(5) UNSIGNED NOT NULL,
`name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`min_pos_x` smallint(5) UNSIGNED DEFAULT NULL,
`max_pos_x` smallint(5) UNSIGNED DEFAULT NULL,
`min_pos_y` smallint(5) UNSIGNED DEFAULT NULL,
`max_pos_y` smallint(5) UNSIGNED DEFAULT NULL,
`min_pos_y` smallint(5) DEFAULT NULL,
`max_pos_y` smallint(5) DEFAULT NULL,
`min_pos_z` smallint(5) UNSIGNED DEFAULT NULL,
`max_pos_z` smallint(5) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Collectibles needed to complete the quest';
Expand Down

0 comments on commit ab72911

Please sign in to comment.