vendethiel / ezarena

Reprise de l'ultimarena pour ajouter plus de fonctionnalités et un RPG !
MIT License
4 stars 3 forks source link

Rewrite questbook killing objectives #76

Open vendethiel opened 6 years ago

vendethiel commented 6 years ago

We should not have to look in the fight history. Instead, when a fight complete, we need to look for currently active quests and update them.

vendethiel commented 6 years ago

It seems like it partly works like I want it to, see adr_battle.php, L1213 as of 3e3fd32863a182c1dff2dcbfd385b1b72695de9e

      // Check if the character killed a monster that he needed for a killing quest !
      $sql    = " SELECT * FROM " . ADR_QUEST_LOG_TABLE . "
        WHERE quest_kill_monster = '" . $monster['monster_name'] . "'
      AND quest_kill_monster_current_amount < quest_kill_monster_amount
      AND user_id = '" . $challenger['character_id'] . "'
        ";
vendethiel commented 6 years ago

There's one really weird element...

in zone_npc_actions, in the $npc_give_action block, we carry around $npc_give_row...

We check if the user has the item.

Two things:

So that means, it's really only an (npc accepts clue) OR (npc wants item(s)) OR (npc wants monsters killed)

Then... We delete the item (we probably should do a DELETE LIMIT? Or maybe we actually want to handle quantity?).

And.. Then we check that A quest wanted those items?! We have gone through npc_items, and emitted a CHEAT if we didn't find the required item. We don't check which quest requires it. We check that some quest wanted that item. ...I actually think this is a check that we do have the quest? We need to change that...

After we've done checking that we do have these items in the quest log, we yet again check that there's no mob kills required.

But it doesn't stop there! We just did check if we could complete the quest via items. Now we check if we can complete it via monsters killed. All good? Except that this line:

if (... && $npc_give_row['quest_kill_monster_current_amount'] == $npc_give_row['npc_kill_monster_amount'])

most definitely doesn't work – or at least doesn't do what it should. Since $npc_give_row is just a check from the adr npcs table, not from the quest log.

I suppose it didn't matter then, because it only deletes quests with the correct amount, but it's still really bad.

winzombie commented 6 years ago

as an option you can make unique monsters, objects, locations. Access to them appeared only when obtaining the necessary quest and also became unavailable after its execution. Quest items are indestructible and can only be sold to a game store.