[HELP] Compile WarpNPC For 4533

Results 1 to 2 of 2
  1. #1
    Member vikkman is offline
    MemberRank
    Jul 2007 Join Date
    86Posts

    [HELP] Compile WarpNPC For 4533

    :eek6:Hy I Have This Script

    Code:
    #include "StdAfx.h"
    #include "Setup.h"
     
    #ifdef WIN32
    #pragma warning(disable:4305)
    #endif
     
    #define MAX_ENTRIES 20
    #define CREATURE 200000
     
    void NPCPlugin::GossipHello(Object * pObject, Player* Plr, bool AutoSend)
    {
    GossipMenu *Menu;
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
    std::vector entries;
    GetTeleportEntries(0,entries);
     
    std::vector::iterator itEntry;
    for(itEntry = entries.begin(); itEntry != entries.end(); itEntry++)
    {
    ct_entry entry = *(itEntry);
     
    if (CanDisplay(entry,Plr))
    Menu->AddItem(entry.icon,entry.gossip,entry.menuid);
     
    }
     
    if(AutoSend)
    Menu->SendTo(Plr);
     
    entries.clear();
    }
     
    void NPCPlugin::GossipSelectOption(Object * pObject, Player* Plr, uint32 Id, uint32 IntId, const char * Code)
    {
    Creature * pCreature = (pObject->GetTypeId()==TYPEID_UNIT)?((Creature*)pObject):NULL;
    if(pCreature==NULL)
    return;
     
    if (IntId == 9999)
    {
    GossipHello(pObject,Plr,true);
    return;
    }
     
    ct_entry entry;
    GetTeleportEntry(IntId,entry);
     
    if (entry.hasChildren)
    {
    GossipMenu * Menu;
    objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
     
    std::vector entries;
    GetTeleportEntries(IntId,entries);
    std::vector::iterator itEntry;
    for(itEntry = entries.begin(); itEntry != entries.end(); itEntry++)
    {
    ct_entry entry = *(itEntry);
     
    if (CanDisplay(entry,Plr))
    Menu->AddItem(entry.icon,entry.gossip,entry.menuid);
    }
     
    if (IntId > 0)
    Menu->AddItem(0, "[Back]", 9999);
     
    entries.clear();
    Menu->SendTo(Plr);
    }
    else
    {
    Plr->EventTeleport(entry.map,entry.position_x,entry.position_y,entry.position_z);
    }
    }
     
    void NPCPlugin::GetTeleportEntries(uint32 parent,std::vector &entries)
    {
    QueryResult * res;
    res = WorldDatabase.Query("SELECT * FROM `custom_teleporter` WHERE creature='%u' AND parent='%u' LIMIT %u",CREATURE,parent,MAX_ENTRIES);
    if(res)
    {
    do
    {
    ct_entry entry;
    if(ProcessEntryData(res,entry)) entries.push_back(entry);
    } while(res->NextRow());
    delete res;
    }
    }
     
    void NPCPlugin::GetTeleportEntry(uint32 id, ct_entry &entry)
    {
    QueryResult * res;
    res = WorldDatabase.Query("SELECT * FROM `custom_teleporter` WHERE creature='%u' AND menuid='%u'",CREATURE,id);
    ProcessEntryData(res,entry);
    }
     
    bool NPCPlugin::CanDisplay(ct_entry entry, Player * Plr)
    {
    if ((entry.team != -1) && (entry.team != Plr->GetTeam())) return false;
    if ((entry.minlevel > 0) && (entry.minlevel = Plr->getLevel())) return false;
    if ((entry.maxlevel > 0) && (entry.maxlevel = Plr->getLevel())) return false;
     
    return true;
    }
     
    bool NPCPlugin::ProcessEntryData(QueryResult * res,ct_entry &entry)
    {
    if(res)
    {
    QueryResult * res2;
    bool hasChildren = false;
    res2 = WorldDatabase.Query("SELECT menuid FROM `custom_teleporter` WHERE creature='%u' AND parent='%u'", CREATURE,res->Fetch()[2].GetUInt32());
     
    if (res2)
    {
    hasChildren = true;
    }
    else
    {
    if (!IsValid(res))
    {
    // If it doesn't have children, it must have valid coordinates
    Log.Color(TRED);
    printf("[Teleporter] Invalid menu entry (creature='%u',menuid='%u')",CREATURE,res->Fetch()[2].GetUInt32());
    Log.Color(TNORMAL);
    Log.Line();
    return false;
    }
    }
     
    entry.creature = res->Fetch()[0].GetUInt32();
    entry.parent = res->Fetch()[1].GetUInt32();
    entry.menuid = res->Fetch()[2].GetUInt32();
    entry.icon = res->Fetch()[3].GetUInt32();
    entry.gossip = res->Fetch()[4].GetString();
    entry.map = res->Fetch()[5].GetUInt32();
    entry.position_x = res->Fetch()[6].GetFloat();
    entry.position_y = res->Fetch()[7].GetFloat();
    entry.position_z = res->Fetch()[8].GetFloat();
    entry.minlevel = res->Fetch()[9].GetUInt32();
    entry.maxlevel = res->Fetch()[10].GetUInt32();
    entry.team = res->Fetch()[11].GetInt32();
    entry.hasChildren = hasChildren;
     
     
    }
    return true;
    }
     
    bool NPCPlugin::IsValid(QueryResult * res)
    {
    return ((res->Fetch()[5].GetString() != 0) &&
    (res->Fetch()[6].GetString() != 0) &&
    (res->Fetch()[7].GetString() != 0) &&
    (res->Fetch()[8].GetString() != 0)
    );
    }
     
    void SetupNPCPlugin(ScriptMgr * mgr)
    {
    GossipScript * gs = (GossipScript*) new NPCPlugin();
    mgr->register_gossip_script(200000, gs); //Warp Patroller
    }
    I Know I Shouldn't Post Here But I Really Need This...
    Can Someone Compile This Script For Me For Ascent Version 4533? PLZ?


  2. #2
    Account Upgraded | Title Enabled! Kira90 is offline
    MemberRank
    Jun 2007 Join Date
    Erm ... Er ... *Sneezes*Location
    320Posts

    Re: [HELP] Compile WarpNPC For 4533

    I will ....

    Its got errors ... Il fix it later ...



Advertisement