Quest Template több nyelven.

Indította NevemSenki, 2013 március 23, 10:22:19 DÉLELŐTT

Előző téma - Következő téma

NevemSenki

Sziasztok.

Egy elég érdekes dolog jutott az eszembe. Regisztrációkor megadható egy LocalId az Auth adatbázis Account táblájában.
http://collab.kpsn.org/display/tc/DB_Auth_account#DB_Auth_account-locale

Én ennek sok jelentőségét még nem láttam. Biztosan van valami funkciója.

Példának okáért vegyük a Quest_Template táblát.
http://collab.kpsn.org/display/tc/Quest+template+tc2

Quest_title, details, angol nyelven található. Mondjuk én bővíteném a táblát ezen oszlopok megkettőzésével, annyi különbséggel hogy hozzáadnám még a LocaleId-t.
" Details_1 "
Így mondjuk kapnék egy angol, és egy Magyar oszlopot.

Most jön a Core Modifikáció.

Megoldható lenne hogy az account táblában lévő, regisztrációkor megadott LocaleId szerint olvassa ki, és jelenítse meg a megfelelő oszlop értékét a Quest_template táblából az adott Player-nek?

Csak úgy elméleti síkon kérdezem, mert a C-hez nem értek.
( Mint kiderült a tegnapi nap folyamán hogy ássam el magam mert semmihez nem ért a vidéki traktoros, de én kíváncsi vagyok.  )

Üdv.: Senki
Csak a Puffin ad neked erőt, és mindent lebíró akaratot!

Locutus

Szia!

Én se nagyon értek hozzá, de ezt szerintem meg lehet csinálni. És annyira nem is rossz ötlet :D Bár nem értem hogy idáig miért nem probálkoztak ezzel. De ki tudja meg kell probálni :D És még valami jó is sülhet ki belőle.

Üdvözlettel Locutus
Álljon fel az ország imádandó széki!
Nemzetek, országok, hódoljatok néki!
Uralkodjék köztünk ész, érdem, igazság,
Törvény s egyenlőség, s te, áldott szabadság!

NevemSenki

Ilyet vagy hasonlót még sehol sem láttam, így egy elég egyedi szervert lehetne a piacra dobni.
Én például nagyon szeretném a Quest-ek szövegeit Magyarul is látni, és lehet hogy ezzel nem vagyok egyedül.
De viszont a külföldiek szerintem nem szeretnék a Magyar szövegeket látni.

Lehet hogy így nagyobb tábort lehetne megfogni.

Én értek egy picit a Kliens-hez is, foglalkoztam vele. Még akár az is megoldható lenne, hogy egy magyar Kliens-el játszhasson az aki szeretne.
Mert ha ez megoldható, akkor lehet hogy a DBC-k is megoldhatóak. És akkor teljesen nyitottá válik az út, egy teljesen Magyar Kliens felé.

Egy kérdést meg elfelejtettem, de besűrítem ide. A DBC fájlokat miért kell külön a Core mellé tenni, mi az oka hogy nem kerültek adatbázisba?

Üdv.: Senki
Csak a Puffin ad neked erőt, és mindent lebíró akaratot!

Armin

Hát ezt max valami script-el lehetne megoldani, ami minden küldi felvétel előtt megnézi, milyen nyelven kellene megjeleníteni a küldit. A gond ugye ott van, hogy ezt máshogy nem lehet kivitelezni, csak egy fránya sql lekéréssel, ami még mindig nem igazán ajánlott script-ek esetében.

Mielőtt megint kapom az oltást, megpróbálom elmagyarázni, miért.
A script-eken keresztül történő sql lekérdezések válaszideje nagyjából 5ms. Ez nem tűnik túl soknak, de ha pl. egyszerre 500 ember vesz fel küldit, akkor 500x5 = 2,5 másodperc. Kb. ekkorát fog laggolni a szerver. A másik topic-ban ugye írták, hogy "melyik szerveren nézné mááá meg egyszerre ennyi ember a top aréna csapatokat?"
Na ott még azt mondtam, hogy van benne valami, de azért a küldiknél már egy kicsit macerásabb a helyzet. Az emu nem véletlenül rántja be az egész adatbázist indulásnál, és nem véletlenül kell minden komolyabb módosítás után restart.

Szóval nem tudom, ezt hogy lehetne kivitelezni.

EroniX

Az SQL-t illetően továbbra se értünk egyet hisz a karaktereket valamint az accountokat és a hozzájuk tartozó alapvető információkat sem tölti be az emu. Gondoljunk csak arra ha valaki karaktert, accountot készít vagy épp jogot ad rájuk akkor sincs restart na mindegy ez nem az a topic. Egyébként én se szeretem ha egy script folyamatosan az adatbázison lóg de azért nem kell ekkora feneket keríteni a dolognak.

Idézetet írta: Armin Dátum 2013 március 23, 05:50:52 DÉLUTÁN
Na ott még azt mondtam, hogy van benne valami, de azért a küldiknél már egy kicsit macerásabb a helyzet. Az emu nem véletlenül rántja be az egész adatbázist indulásnál, és nem véletlenül kell minden komolyabb módosítás után restart.

Szóval nem tudom, ezt hogy lehetne kivitelezni.
Nem értem ezen mit problémázol hisz ha indulásnál az emu betudja tölteni az angol szöveget akkor a magyart is nem?  :-\
Azuregos Delta Force

Armin

Persze, de mint írtam, max úgy lehet, hogy minden küldi előtt megnézi, melyik kell.
Nem kell egyetérteni. Nézz utána, vagy próbáld ki. Ac-Weben pl. simán falnak mennek az ilyen script-ektől. Nem véletlenül.

EroniX

#6
Idézetet írta: Armin Dátum 2013 március 23, 06:19:22 DÉLUTÁN
Persze, de mint írtam, max úgy lehet, hogy minden küldi előtt megnézi, melyik kell.
Nem nem te ezt írtad:
Idézetet írta: Armin Dátum 2013 március 23, 05:50:52 DÉLUTÁN
A script-eken keresztül történő sql lekérdezések válaszideje nagyjából 5ms. Ez nem tűnik túl soknak, de ha pl. egyszerre 500 ember vesz fel küldit, akkor 500x5 = 2,5 másodperc. Kb. ekkorát fog laggolni a szerver.
Erre írtam ezt:
Idézetet írta: EroniX Dátum 2013 március 23, 06:07:08 DÉLUTÁN
Nem értem ezen mit problémázol hisz ha indulásnál az emu betudja tölteni az angol szöveget akkor a magyart is nem?  :-\
Azuregos Delta Force

Armin

#7
No akkor fussunk neki még egyszer  ;D

Idéz
Hát ezt max valami script-el lehetne megoldani, ami minden küldi felvétel előtt megnézi, milyen nyelven kellene megjeleníteni a küldit.


Idéz
Nem értem ezen mit problémázol hisz ha indulásnál az emu betudja tölteni az angol szöveget akkor a magyart is nem?

Igen, betölteni be tudja, de minden egyes küldifelvétel előtt, küldileadásnál, stb. lógnia kéne az account táblán, hogy mi a LocaleId-d, és ezalapján megjeleníteni a szöveget. Vagy ha esetleg van olyan emu, ami indulásnál már tudni fogja előre hogy ki fog fellépni, akkor nem szóltam  :)

Ilyen szinten még nem igazán bújtam bele az emuba, de szerintem biztos kell lennie valami megoldásnak, nem csak a mysql_query-nek...

NevemSenki

Most ez egy hülye kérdés lesz. De C-ben nem létezik egy olyan változó amit cipel magával a felhasználó?
Mint mondjuk valami olyasmire gondoltam, mint PHP-en a SESSION + egy If.

A SESSION-t cipeli magával a felhasználó, nem cipeli... de értitek... És egy CASE vagy If segítségével választaná ki, hogy melyik oszlopból olvassa az adatot.

Ez csak elmélet, meg minden. Szóval nem kiakadni. :)

Üdv.: Senki
Csak a Puffin ad neked erőt, és mindent lebíró akaratot!

Armin

#9
Én is azt akarom megnézni, hogy kezeli az emu a db dolgokat, mert nem láttam még, hogy tele lenne pakolva mysql parancsokkal, pedig rendesen írkálja az adatbázist menet közben is.

Amúgy, hogy egy kicsit témánál is maradjunk:
Meg kell nézni az emuban a küldikre vonatkozó kódokat. Akkor talán okosabbak leszünk, hogy mit kellene módosítani.

Szerk:

Na itt már az is jó móka lesz, hogy a saját oszlopokat kezelje az emu  ;D


/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef TRINITYCORE_QUEST_H
#define TRINITYCORE_QUEST_H

#include "Define.h"
#include "DatabaseEnv.h"
#include "SharedDefines.h"
#include "DBCEnums.h"

#include <string>
#include <vector>

class Player;

class ObjectMgr;

#define MAX_QUEST_LOG_SIZE 25

#define QUEST_OBJECTIVES_COUNT 4
#define QUEST_ITEM_OBJECTIVES_COUNT 6
#define QUEST_SOURCE_ITEM_IDS_COUNT 4
#define QUEST_REWARD_CHOICES_COUNT 6
#define QUEST_REWARDS_COUNT 4
#define QUEST_DEPLINK_COUNT 10
#define QUEST_REPUTATIONS_COUNT 5
#define QUEST_EMOTE_COUNT 4
#define QUEST_PVP_KILL_SLOT 0

enum QuestFailedReasons
{
    INVALIDREASON_DONT_HAVE_REQ                 = 0,
    INVALIDREASON_QUEST_FAILED_LOW_LEVEL        = 1,        // You are not high enough level for that quest.
    INVALIDREASON_QUEST_FAILED_WRONG_RACE       = 6,        // That quest is not available to your race.
    INVALIDREASON_QUEST_ALREADY_DONE            = 7,        // You have completed that quest.
    INVALIDREASON_QUEST_ONLY_ONE_TIMED          = 12,       // You can only be on one timed quest at a time.
    INVALIDREASON_QUEST_ALREADY_ON              = 13,       // You are already on that quest.
    INVALIDREASON_QUEST_FAILED_EXPANSION        = 16,       // This quest requires an expansion enabled account.
    INVALIDREASON_QUEST_ALREADY_ON2             = 18,       // You are already on that quest.
    INVALIDREASON_QUEST_FAILED_MISSING_ITEMS    = 21,       // You don't have the required items with you. Check storage.
    INVALIDREASON_QUEST_FAILED_NOT_ENOUGH_MONEY = 23,       // You don't have enough money for that quest.
    INVALIDREASON_DAILY_QUESTS_REMAINING        = 26,       // You have already completed 25 daily quests today.
    INVALIDREASON_QUEST_FAILED_CAIS             = 27,       // You cannot complete quests once you have reached tired time.
    INVALIDREASON_DAILY_QUEST_COMPLETED_TODAY   = 29        // You have completed that daily quest today.
};

enum QuestShareMessages
{
    QUEST_PARTY_MSG_SHARING_QUEST           = 0,
    QUEST_PARTY_MSG_CANT_TAKE_QUEST         = 1,
    QUEST_PARTY_MSG_ACCEPT_QUEST            = 2,
    QUEST_PARTY_MSG_DECLINE_QUEST           = 3,
    QUEST_PARTY_MSG_BUSY                    = 4,
    QUEST_PARTY_MSG_LOG_FULL                = 5,
    QUEST_PARTY_MSG_HAVE_QUEST              = 6,
    QUEST_PARTY_MSG_FINISH_QUEST            = 7,
    QUEST_PARTY_MSG_CANT_BE_SHARED_TODAY    = 8,
    QUEST_PARTY_MSG_SHARING_TIMER_EXPIRED   = 9,
    QUEST_PARTY_MSG_NOT_IN_PARTY            = 10
};

enum __QuestTradeSkill
{
    QUEST_TRSKILL_NONE           = 0,
    QUEST_TRSKILL_ALCHEMY        = 1,
    QUEST_TRSKILL_BLACKSMITHING  = 2,
    QUEST_TRSKILL_COOKING        = 3,
    QUEST_TRSKILL_ENCHANTING     = 4,
    QUEST_TRSKILL_ENGINEERING    = 5,
    QUEST_TRSKILL_FIRSTAID       = 6,
    QUEST_TRSKILL_HERBALISM      = 7,
    QUEST_TRSKILL_LEATHERWORKING = 8,
    QUEST_TRSKILL_POISONS        = 9,
    QUEST_TRSKILL_TAILORING      = 10,
    QUEST_TRSKILL_MINING         = 11,
    QUEST_TRSKILL_FISHING        = 12,
    QUEST_TRSKILL_SKINNING       = 13,
    QUEST_TRSKILL_JEWELCRAFTING  = 14
};

enum QuestStatus
{
    QUEST_STATUS_NONE           = 0,
    QUEST_STATUS_COMPLETE       = 1,
    //QUEST_STATUS_UNAVAILABLE    = 2,
    QUEST_STATUS_INCOMPLETE     = 3,
    //QUEST_STATUS_AVAILABLE      = 4,
    QUEST_STATUS_FAILED         = 5,
    QUEST_STATUS_REWARDED       = 6,        // Not used in DB
    MAX_QUEST_STATUS
};

enum __QuestGiverStatus
{
    DIALOG_STATUS_NONE                     = 0,
    DIALOG_STATUS_UNAVAILABLE              = 1,
    DIALOG_STATUS_LOW_LEVEL_AVAILABLE      = 2,
    DIALOG_STATUS_LOW_LEVEL_REWARD_REP     = 3,
    DIALOG_STATUS_LOW_LEVEL_AVAILABLE_REP  = 4,
    DIALOG_STATUS_INCOMPLETE               = 5,
    DIALOG_STATUS_REWARD_REP               = 6,
    DIALOG_STATUS_AVAILABLE_REP            = 7,
    DIALOG_STATUS_AVAILABLE                = 8,
    DIALOG_STATUS_REWARD2                  = 9,             // no yellow dot on minimap
    DIALOG_STATUS_REWARD                   = 10             // yellow dot on minimap
};

enum QuestFlags
{
    // Flags used at server and sent to client
    QUEST_FLAGS_NONE           = 0x00000000,
    QUEST_FLAGS_STAY_ALIVE     = 0x00000001,                // Not used currently
    QUEST_FLAGS_PARTY_ACCEPT   = 0x00000002,                // Not used currently. If player in party, all players that can accept this quest will receive confirmation box to accept quest CMSG_QUEST_CONFIRM_ACCEPT/SMSG_QUEST_CONFIRM_ACCEPT
    QUEST_FLAGS_EXPLORATION    = 0x00000004,                // Not used currently
    QUEST_FLAGS_SHARABLE       = 0x00000008,                // Can be shared: Player::CanShareQuest()
    //QUEST_FLAGS_NONE2        = 0x00000010,                // Not used currently
    QUEST_FLAGS_EPIC           = 0x00000020,                // Not used currently: Unsure of content
    QUEST_FLAGS_RAID           = 0x00000040,                // Not used currently
    QUEST_FLAGS_TBC            = 0x00000080,                // Not used currently: Available if TBC expansion enabled only
    QUEST_FLAGS_DELIVER_MORE   = 0x00000100,                // Not used currently: _DELIVER_MORE Quest needs more than normal _q-item_ drops from mobs
    QUEST_FLAGS_HIDDEN_REWARDS = 0x00000200,                // Items and money rewarded only sent in SMSG_QUESTGIVER_OFFER_REWARD (not in SMSG_QUESTGIVER_QUEST_DETAILS or in client quest log(SMSG_QUEST_QUERY_RESPONSE))
    QUEST_FLAGS_AUTO_REWARDED  = 0x00000400,                // These quests are automatically rewarded on quest complete and they will never appear in quest log client side.
    QUEST_FLAGS_TBC_RACES      = 0x00000800,                // Not used currently: Blood elf/Draenei starting zone quests
    QUEST_FLAGS_DAILY          = 0x00001000,                // Used to know quest is Daily one
    QUEST_FLAGS_REPEATABLE     = 0x00002000,                // Used on repeatable quests (3.0.0+)
    QUEST_FLAGS_UNAVAILABLE    = 0x00004000,                // Used on quests that are not generically available
    QUEST_FLAGS_WEEKLY         = 0x00008000,
    QUEST_FLAGS_AUTOCOMPLETE   = 0x00010000,                // auto complete
    QUEST_FLAGS_SPECIAL_ITEM   = 0x00020000,                // has something to do with RequiredItemId and SourceItemId
    QUEST_FLAGS_OBJ_TEXT       = 0x00040000,                // use Objective text as Complete text
    QUEST_FLAGS_AUTO_ACCEPT    = 0x00080000,                // The client recognizes this flag as auto-accept. However, NONE of the current quests (3.3.5a) have this flag. Maybe blizz used to use it, or will use it in the future.

    // Trinity flags for set SpecialFlags in DB if required but used only at server
    QUEST_TRINITY_FLAGS_REPEATABLE           = 0x00100000,   // Set by 1 in SpecialFlags from DB
    QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT = 0x00200000,   // Set by 2 in SpecialFlags from DB (if reequired area explore, spell SPELL_EFFECT_QUEST_COMPLETE casting, table `*_script` command SCRIPT_COMMAND_QUEST_EXPLORED use, set from script)
    QUEST_TRINITY_FLAGS_AUTO_ACCEPT          = 0x00400000,  // Set by 4 in SpecialFlags in DB if the quest is to be auto-accepted.
    QUEST_TRINITY_FLAGS_DF_QUEST             = 0x00800000,  // Set by 8 in SpecialFlags in DB if the quest is used by Dungeon Finder.
    QUEST_TRINITY_FLAGS_MONTHLY              = 0x01000000,  // Set by 16 in SpecialFlags in DB if the quest is reset at the begining of the month

    QUEST_TRINITY_FLAGS_DB_ALLOWED = 0xFFFFF | QUEST_TRINITY_FLAGS_REPEATABLE | QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT | QUEST_TRINITY_FLAGS_AUTO_ACCEPT | QUEST_TRINITY_FLAGS_DF_QUEST | QUEST_TRINITY_FLAGS_MONTHLY,

    // Trinity flags for internal use only
    QUEST_TRINITY_FLAGS_DELIVER              = 0x04000000,   // Internal flag computed only
    QUEST_TRINITY_FLAGS_SPEAKTO              = 0x08000000,   // Internal flag computed only
    QUEST_TRINITY_FLAGS_KILL_OR_CAST         = 0x10000000,   // Internal flag computed only
    QUEST_TRINITY_FLAGS_TIMED                = 0x20000000,   // Internal flag computed only
    QUEST_TRINITY_FLAGS_PLAYER_KILL          = 0x40000000    // Internal flag computed only
};

struct QuestLocale
{
    QuestLocale() { ObjectiveText.resize(QUEST_OBJECTIVES_COUNT); }

    StringVector Title;
    StringVector Details;
    StringVector Objectives;
    StringVector OfferRewardText;
    StringVector RequestItemsText;
    StringVector EndText;
    StringVector CompletedText;
    std::vector< StringVector > ObjectiveText;
};

// This Quest class provides a convenient way to access a few pretotaled (cached) quest details,
// all base quest information, and any utility functions such as generating the amount of
// xp to give
class Quest
{
    friend class ObjectMgr;
    public:
        Quest(Field* questRecord);
        uint32 XPValue(Player* player) const;

        bool HasFlag(uint32 flag) const { return (Flags & flag) != 0; }
        void SetFlag(uint32 flag) { Flags |= flag; }

        // table data accessors:
        uint32 GetQuestId() const { return Id; }
        uint32 GetQuestMethod() const { return Method; }
        int32  GetZoneOrSort() const { return ZoneOrSort; }
        uint32 GetMinLevel() const { return MinLevel; }
        uint32 GetMaxLevel() const { return MaxLevel; }
        int32  GetQuestLevel() const { return Level; }
        uint32 GetType() const { return Type; }
        uint32 GetRequiredClasses() const { return RequiredClasses; }
        uint32 GetRequiredRaces() const { return RequiredRaces; }
        uint32 GetRequiredSkill() const { return RequiredSkillId; }
        uint32 GetRequiredSkillValue() const { return RequiredSkillPoints; }
        uint32 GetRepObjectiveFaction() const { return RequiredFactionId1; }
        int32  GetRepObjectiveValue() const { return RequiredFactionValue1; }
        uint32 GetRepObjectiveFaction2() const { return RequiredFactionId2; }
        int32  GetRepObjectiveValue2() const { return RequiredFactionValue2; }
        uint32 GetRequiredMinRepFaction() const { return RequiredMinRepFaction; }
        int32  GetRequiredMinRepValue() const { return RequiredMinRepValue; }
        uint32 GetRequiredMaxRepFaction() const { return RequiredMaxRepFaction; }
        int32  GetRequiredMaxRepValue() const { return RequiredMaxRepValue; }
        uint32 GetSuggestedPlayers() const { return SuggestedPlayers; }
        uint32 GetLimitTime() const { return LimitTime; }
        int32  GetPrevQuestId() const { return PrevQuestId; }
        int32  GetNextQuestId() const { return NextQuestId; }
        int32  GetExclusiveGroup() const { return ExclusiveGroup; }
        uint32 GetNextQuestInChain() const { return NextQuestIdChain; }
        uint32 GetCharTitleId() const { return RewardTitleId; }
        uint32 GetPlayersSlain() const { return RequiredPlayerKills; }
        uint32 GetBonusTalents() const { return RewardTalents; }
        int32  GetRewArenaPoints() const {return RewardArenaPoints; }
        uint32 GetXPId() const { return RewardXPId; }
        uint32 GetSrcItemId() const { return SourceItemId; }
        uint32 GetSrcItemCount() const { return SourceItemIdCount; }
        uint32 GetSrcSpell() const { return SourceSpellid; }
        std::string const& GetTitle() const { return Title; }
        std::string const& GetDetails() const { return Details; }
        std::string const& GetObjectives() const { return Objectives; }
        std::string const& GetOfferRewardText() const { return OfferRewardText; }
        std::string const& GetRequestItemsText() const { return RequestItemsText; }
        std::string const& GetEndText() const { return EndText; }
        std::string const& GetCompletedText() const { return CompletedText; }
        int32  GetRewOrReqMoney() const;
        uint32 GetRewHonorAddition() const { return RewardHonor; }
        float GetRewHonorMultiplier() const { return RewardHonorMultiplier; }
        uint32 GetRewMoneyMaxLevel() const { return RewardMoneyMaxLevel; } // use in XP calculation at client
        uint32 GetRewSpell() const { return RewardSpell; }
        int32  GetRewSpellCast() const { return RewardSpellCast; }
        uint32 GetRewMailTemplateId() const { return RewardMailTemplateId; }
        uint32 GetRewMailDelaySecs() const { return RewardMailDelay; }
        uint32 GetPointMapId() const { return PointMapId; }
        float  GetPointX() const { return PointX; }
        float  GetPointY() const { return PointY; }
        uint32 GetPointOpt() const { return PointOption; }
        uint32 GetIncompleteEmote() const { return EmoteOnIncomplete; }
        uint32 GetCompleteEmote() const { return EmoteOnComplete; }
        bool   IsRepeatable() const { return Flags & QUEST_TRINITY_FLAGS_REPEATABLE; }
        bool   IsAutoAccept() const;
        bool   IsAutoComplete() const;
        uint32 GetFlags() const { return Flags; }
        bool   IsDaily() const { return Flags & QUEST_FLAGS_DAILY; }
        bool   IsWeekly() const { return Flags & QUEST_FLAGS_WEEKLY; }
        bool   IsMonthly() const { return Flags & QUEST_TRINITY_FLAGS_MONTHLY; }
        bool   IsSeasonal() const { return (ZoneOrSort == -QUEST_SORT_SEASONAL || ZoneOrSort == -QUEST_SORT_SPECIAL || ZoneOrSort == -QUEST_SORT_LUNAR_FESTIVAL || ZoneOrSort == -QUEST_SORT_MIDSUMMER || ZoneOrSort == -QUEST_SORT_BREWFEST || ZoneOrSort == -QUEST_SORT_LOVE_IS_IN_THE_AIR || ZoneOrSort == -QUEST_SORT_NOBLEGARDEN) && !IsRepeatable(); }
        bool   IsDailyOrWeekly() const { return Flags & (QUEST_FLAGS_DAILY | QUEST_FLAGS_WEEKLY); }
        bool   IsRaidQuest(Difficulty difficulty) const;
        bool   IsAllowedInRaid(Difficulty difficulty) const;
        bool   IsDFQuest() const { return Flags & QUEST_TRINITY_FLAGS_DF_QUEST; }
        uint32 CalculateHonorGain(uint8 level) const;

        // multiple values
        std::string ObjectiveText[QUEST_OBJECTIVES_COUNT];
        uint32 RequiredItemId[QUEST_ITEM_OBJECTIVES_COUNT];
        uint32 RequiredItemCount[QUEST_ITEM_OBJECTIVES_COUNT];
        uint32 RequiredSourceItemId[QUEST_SOURCE_ITEM_IDS_COUNT];
        uint32 RequiredSourceItemCount[QUEST_SOURCE_ITEM_IDS_COUNT];
        int32  RequiredNpcOrGo[QUEST_OBJECTIVES_COUNT];   // >0 Creature <0 Gameobject
        uint32 RequiredNpcOrGoCount[QUEST_OBJECTIVES_COUNT];
        uint32 RequiredSpellCast[QUEST_OBJECTIVES_COUNT];
        uint32 RewardChoiceItemId[QUEST_REWARD_CHOICES_COUNT];
        uint32 RewardChoiceItemCount[QUEST_REWARD_CHOICES_COUNT];
        uint32 RewardItemId[QUEST_REWARDS_COUNT];
        uint32 RewardItemIdCount[QUEST_REWARDS_COUNT];
        uint32 RewardFactionId[QUEST_REPUTATIONS_COUNT];
        int32  RewardFactionValueId[QUEST_REPUTATIONS_COUNT];
        int32  RewardFactionValueIdOverride[QUEST_REPUTATIONS_COUNT];
        uint32 DetailsEmote[QUEST_EMOTE_COUNT];
        uint32 DetailsEmoteDelay[QUEST_EMOTE_COUNT];
        uint32 OfferRewardEmote[QUEST_EMOTE_COUNT];
        uint32 OfferRewardEmoteDelay[QUEST_EMOTE_COUNT];

        uint32 GetReqItemsCount() const { return m_reqitemscount; }
        uint32 GetReqCreatureOrGOcount() const { return m_reqCreatureOrGOcount; }
        uint32 GetRewChoiceItemsCount() const { return m_rewchoiceitemscount; }
        uint32 GetRewItemsCount() const { return m_rewitemscount; }

        typedef std::vector<int32> PrevQuests;
        PrevQuests prevQuests;
        typedef std::vector<uint32> PrevChainQuests;
        PrevChainQuests prevChainQuests;

        // cached data
    private:
        uint32 m_reqitemscount;
        uint32 m_reqCreatureOrGOcount;
        uint32 m_rewchoiceitemscount;
        uint32 m_rewitemscount;

        // table data
    protected:
        uint32 Id;
        uint32 Method;
        int32  ZoneOrSort;
        uint32 MinLevel;
        uint32 MaxLevel;
        int32  Level;
        uint32 Type;
        uint32 RequiredClasses;
        uint32 RequiredRaces;
        uint32 RequiredSkillId;
        uint32 RequiredSkillPoints;
        uint32 RequiredFactionId1;
        int32  RequiredFactionValue1;
        uint32 RequiredFactionId2;
        int32  RequiredFactionValue2;
        uint32 RequiredMinRepFaction;
        int32  RequiredMinRepValue;
        uint32 RequiredMaxRepFaction;
        int32  RequiredMaxRepValue;
        uint32 SuggestedPlayers;
        uint32 LimitTime;
        uint32 Flags;
        uint32 RewardTitleId;
        uint32 RequiredPlayerKills;
        uint32 RewardTalents;
        int32  RewardArenaPoints;
        int32  PrevQuestId;
        int32  NextQuestId;
        int32  ExclusiveGroup;
        uint32 NextQuestIdChain;
        uint32 RewardXPId;
        uint32 SourceItemId;
        uint32 SourceItemIdCount;
        uint32 SourceSpellid;
        std::string Title;
        std::string Details;
        std::string Objectives;
        std::string OfferRewardText;
        std::string RequestItemsText;
        std::string EndText;
        std::string CompletedText;
        uint32 RewardHonor;
        float RewardHonorMultiplier;
        int32  RewardOrRequiredMoney;
        uint32 RewardMoneyMaxLevel;
        uint32 RewardSpell;
        int32  RewardSpellCast;
        uint32 RewardMailTemplateId;
        uint32 RewardMailDelay;
        uint32 PointMapId;
        float  PointX;
        float  PointY;
        uint32 PointOption;
        uint32 EmoteOnIncomplete;
        uint32 EmoteOnComplete;
};

struct QuestStatusData
{
    QuestStatusData(): Status(QUEST_STATUS_NONE), Timer(0), PlayerCount(0), Explored(false)
    {
        memset(ItemCount, 0, QUEST_ITEM_OBJECTIVES_COUNT * sizeof(uint16));
        memset(CreatureOrGOCount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint16));
    }

    QuestStatus Status;
    uint32 Timer;
    uint16 ItemCount[QUEST_ITEM_OBJECTIVES_COUNT];
    uint16 CreatureOrGOCount[QUEST_OBJECTIVES_COUNT];
    uint16 PlayerCount;
    bool Explored;
};
#endif

Armin

#10

/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "QuestDef.h"
#include "Player.h"
#include "World.h"

Quest::Quest(Field* questRecord)
{
    Id = questRecord[0].GetUInt32();
    Method = questRecord[1].GetUInt8();
    Level = questRecord[2].GetInt16();
    MinLevel = questRecord[3].GetUInt8();
    MaxLevel = questRecord[4].GetUInt8();
    ZoneOrSort = questRecord[5].GetInt16();
    Type = questRecord[6].GetUInt16();
    SuggestedPlayers = questRecord[7].GetUInt8();
    LimitTime = questRecord[8].GetUInt32();
    RequiredClasses = questRecord[9].GetUInt16();
    RequiredRaces = questRecord[10].GetUInt16();
    RequiredSkillId = questRecord[11].GetUInt16();
    RequiredSkillPoints = questRecord[12].GetUInt16();
    RequiredFactionId1 = questRecord[13].GetUInt16();
    RequiredFactionId2 = questRecord[14].GetUInt16();
    RequiredFactionValue1 = questRecord[15].GetInt32();
    RequiredFactionValue2 = questRecord[16].GetInt32();
    RequiredMinRepFaction = questRecord[17].GetUInt16();
    RequiredMaxRepFaction = questRecord[18].GetUInt16();
    RequiredMinRepValue = questRecord[19].GetInt32();
    RequiredMaxRepValue = questRecord[20].GetInt32();
    PrevQuestId = questRecord[21].GetInt32();
    NextQuestId = questRecord[22].GetInt32();
    ExclusiveGroup = questRecord[23].GetInt32();
    NextQuestIdChain = questRecord[24].GetUInt32();
    RewardXPId = questRecord[25].GetUInt8();
    RewardOrRequiredMoney = questRecord[26].GetInt32();
    RewardMoneyMaxLevel = questRecord[27].GetUInt32();
    RewardSpell = questRecord[28].GetUInt32();
    RewardSpellCast = questRecord[29].GetInt32();
    RewardHonor = questRecord[30].GetUInt32();
    RewardHonorMultiplier = questRecord[31].GetFloat();
    RewardMailTemplateId = questRecord[32].GetUInt32();
    RewardMailDelay = questRecord[33].GetUInt32();
    SourceItemId = questRecord[34].GetUInt32();
    SourceItemIdCount = questRecord[35].GetUInt8();
    SourceSpellid = questRecord[36].GetUInt32();
    Flags = questRecord[37].GetUInt32();
    uint32 SpecialFlags = questRecord[38].GetUInt8();
    RewardTitleId = questRecord[39].GetUInt8();
    RequiredPlayerKills = questRecord[40].GetUInt8();
    RewardTalents = questRecord[41].GetUInt8();
    RewardArenaPoints = questRecord[42].GetUInt16();

    for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
        RewardItemId[i] = questRecord[43+i].GetUInt32();

    for (int i = 0; i < QUEST_REWARDS_COUNT; ++i)
        RewardItemIdCount[i] = questRecord[47+i].GetUInt16();

    for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
        RewardChoiceItemId[i] = questRecord[51+i].GetUInt32();

    for (int i = 0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
        RewardChoiceItemCount[i] = questRecord[57+i].GetUInt16();

    for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
        RewardFactionId[i] = questRecord[63+i].GetUInt16();

    for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
        RewardFactionValueId[i] = questRecord[68+i].GetInt32();

    for (int i = 0; i < QUEST_REPUTATIONS_COUNT; ++i)
        RewardFactionValueIdOverride[i] = questRecord[73+i].GetInt32();

    PointMapId = questRecord[78].GetUInt16();
    PointX = questRecord[79].GetFloat();
    PointY = questRecord[80].GetFloat();
    PointOption = questRecord[81].GetUInt32();
    Title = questRecord[82].GetString();
    Objectives = questRecord[83].GetString();
    Details = questRecord[84].GetString();
    EndText = questRecord[85].GetString();
    OfferRewardText = questRecord[86].GetString();
    RequestItemsText = questRecord[87].GetString();
    CompletedText = questRecord[88].GetString();

    for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
        RequiredNpcOrGo[i] = questRecord[89+i].GetInt32();

    for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
        RequiredNpcOrGoCount[i] = questRecord[93+i].GetUInt16();

    for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
        RequiredSourceItemId[i] = questRecord[97+i].GetUInt32();

    for (int i = 0; i < QUEST_SOURCE_ITEM_IDS_COUNT; ++i)
        RequiredSourceItemCount[i] = questRecord[101+i].GetUInt16();

    for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
        RequiredItemId[i] = questRecord[105+i].GetUInt32();

    for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
        RequiredItemCount[i] = questRecord[111+i].GetUInt16();

    for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
        RequiredSpellCast[i] = questRecord[117+i].GetUInt32();

    // int8 Unknown0 = questRecord[121].GetUInt8();

    for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i)
        ObjectiveText[i] = questRecord[122+i].GetString();

    for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
        DetailsEmote[i] = questRecord[126+i].GetUInt16();

    for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
        DetailsEmoteDelay[i] = questRecord[130+i].GetUInt32();

    EmoteOnIncomplete = questRecord[134].GetUInt16();
    EmoteOnComplete = questRecord[135].GetUInt16();

    for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
        OfferRewardEmote[i] = questRecord[136+i].GetInt16();

    for (int i = 0; i < QUEST_EMOTE_COUNT; ++i)
        OfferRewardEmoteDelay[i] = questRecord[140+i].GetInt32();

    //int32 WDBVerified = questRecord[144].GetInt32();

    Flags |= SpecialFlags << 20;
    if (Flags & QUEST_TRINITY_FLAGS_AUTO_ACCEPT)
        Flags |= QUEST_FLAGS_AUTO_ACCEPT;

    m_reqitemscount = 0;
    m_reqCreatureOrGOcount = 0;
    m_rewitemscount = 0;
    m_rewchoiceitemscount = 0;

    for (int i=0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
        if (RequiredItemId[i])
            ++m_reqitemscount;

    for (int i=0; i < QUEST_OBJECTIVES_COUNT; ++i)
        if (RequiredNpcOrGo[i])
            ++m_reqCreatureOrGOcount;

    for (int i=0; i < QUEST_REWARDS_COUNT; ++i)
        if (RewardItemId[i])
            ++m_rewitemscount;

    for (int i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
        if (RewardChoiceItemId[i])
            ++m_rewchoiceitemscount;
}

uint32 Quest::XPValue(Player* player) const
{
    if (player)
    {
        int32 quest_level = (Level == -1 ? player->getLevel() : Level);
        const QuestXPEntry* xpentry = sQuestXPStore.LookupEntry(quest_level);
        if (!xpentry)
            return 0;

        int32 diffFactor = 2 * (quest_level - player->getLevel()) + 20;
        if (diffFactor < 1)
            diffFactor = 1;
        else if (diffFactor > 10)
            diffFactor = 10;

        uint32 xp = diffFactor * xpentry->Exp[RewardXPId] / 10;
        if (xp <= 100)
            xp = 5 * ((xp + 2) / 5);
        else if (xp <= 500)
            xp = 10 * ((xp + 5) / 10);
        else if (xp <= 1000)
            xp = 25 * ((xp + 12) / 25);
        else
            xp = 50 * ((xp + 25) / 50);

        return xp;
    }

    return 0;
}

int32 Quest::GetRewOrReqMoney() const
{
    if (RewardOrRequiredMoney <= 0)
        return RewardOrRequiredMoney;

    return int32(RewardOrRequiredMoney * sWorld->getRate(RATE_DROP_MONEY));
}

bool Quest::IsAutoAccept() const
{
    return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_ACCEPT) ? false : (Flags & QUEST_FLAGS_AUTO_ACCEPT);
}

bool Quest::IsAutoComplete() const
{
    return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_AUTO_COMPLETE) ? false : (Method == 0 || HasFlag(QUEST_FLAGS_AUTOCOMPLETE));
}

bool Quest::IsRaidQuest(Difficulty difficulty) const
{
    switch (Type)
    {
        case QUEST_TYPE_RAID:
            return true;
        case QUEST_TYPE_RAID_10:
            return !(difficulty & RAID_DIFFICULTY_MASK_25MAN);
        case QUEST_TYPE_RAID_25:
            return difficulty & RAID_DIFFICULTY_MASK_25MAN;
        default:
            break;
    }

    return false;
}

bool Quest::IsAllowedInRaid(Difficulty difficulty) const
{
    if (IsRaidQuest(difficulty))
        return true;

    return sWorld->getBoolConfig(CONFIG_QUEST_IGNORE_RAID);
}

uint32 Quest::CalculateHonorGain(uint8 level) const
{
    if (level > GT_MAX_LEVEL)
        level = GT_MAX_LEVEL;

    uint32 honor = 0;

    if (GetRewHonorAddition() > 0 || GetRewHonorMultiplier() > 0.0f)
    {
        // values stored from 0.. for 1...
        TeamContributionPointsEntry const* tc = sTeamContributionPointsStore.LookupEntry(level);
        if (!tc)
            return 0;

        honor = uint32(tc->value * GetRewHonorMultiplier() * 0.1f);
        honor += GetRewHonorAddition();
    }

    return honor;
}


NevemSenki

#11
Kiegészítve az előző hozzászólásomat.

Én arra gondoltam, hogy mikor a felhasználó belép a world-be, akkor néznénk meg hogy mi a LocaleId-je, és azt betennék egy, az azon Player-hez tartozó változóba.
Majd a Quest-eket intéző Script-ben, az alapján választanánk ki a neki kellő szöveget.

Egyet viszont nem értek. Mikor a játékos egy Quest-et megjeleníttet, akkor nem kéri le az emu magát a Quest-hez tartozó dolgokat, hanem SQL lekérés nélkül képes megjeleníteni?
Ez lehet hülyeség, de hát csak le kéne kérnie. És ha lekéri akkor ott bele lehet nyúlni a mechanizmusba.
Vagy nem?

Szerintem ez lenne az:

Kód (c++) Kijelölés
    Title = questRecord[82].GetString();
    Objectives = questRecord[83].GetString();
    Details = questRecord[84].GetString();
    EndText = questRecord[85].GetString();


Üdv.: Senki
Csak a Puffin ad neked erőt, és mindent lebíró akaratot!

Armin

Hát amikor már betöltötte az emu a küldiket, utána már nem nyúl hozzá. Pl. próbáld ki, hogy emu futás közben írd át valamelyik küldi szövegét, és utána vedd fel a küldit. Mit fogsz látni? az eredeti szöveget. Csak akkor módosul, ha újraindítod a szervert, vagy tolsz a küldiknek egy reload-ot. Szóval menet közben nem piszkálja. Szerintem akkor is fel tudnád venni az adott küldit, ha közben adatbázisból kitörlöd  ;D
Mindenképp úgy kellene megcsinálni, hogy belépés után tárolja valahogy a LocaleId-t, erre emlékezzen is, és ennek megfelelően mutassa a szöveget. Ahogy írtad is. Ha nem akarsz nagy player számnál gubancot, akkor így csináld. Nehogy lekérd minden küldinél.

AximCore

Egyszerű, amikor login történik és a world megkapja a játékost akkor plusz egy ilyen információt hordoz magával ( lokalizációról )  aztán amikor felveszi a quest-et vagy akár itt tovább lehet menni trainerek stb ott vizsgálja, hogy a memóriából melyik quest-et kel olvasni ( magyar vagy angol ). Megvalósítása más dolog, de megvalósítható úgy, hogy ne zabáljon és pörgesse a mysqlt.
"Tanítani lehet az ostobát, de gondolkodásra bírni nem."
A Talmud

Windows Firewall
http://devopsreactions.tumblr.com/

Why use Windows, if you have open doors... to Linux

NevemSenki

Nem hangzik rosszul, tehát akkor úgy néz ki hogy megoldható.
Hol kéne keresgélni a

Idézamikor login történik és a world megkapja a játékost akkor plusz egy ilyen információt hordoz magával ( lokalizációról )

és hasonló dolgok után?

Elmondom újra, én csak elméletben foglalkoztam ezzel eddig, fingom nincs az egész dologról. Ezért is kérdezlek titeket.

Üdv.: Senki
Csak a Puffin ad neked erőt, és mindent lebíró akaratot!

Powered by EzPortal