[Release] Playermenu menu

User Tag List

Results 1 to 15 of 15
  1. #1
    shanjo's Avatar Member
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Release] Playermenu

    PlayerMenu (C++)

    Playermenu adds an command ingame for players, i will add more stuff from time to time.
    This is what it contains now
    [The Vendor uses the slot 80000]

    .Playermenu
    RemoveSickness - Removes Res Sickness
    TeleportList - Gives u a list of Teleport Locations
    Go - Teleports u to Place from the list
    AddTele - Adds Teleport place (Only for Z Gm)
    Vendor - Spawns a Private Vendor (Put 1 infront of it or else it wont spawn)
    RemoveVendor - Removes the Vendor (Im trying to make it so it will make a log of who spawned which mobs so players can get warnings and maybe even temp and perm bans when not deleting vendor when done)

    More to Come (:

    Credits ;
    Shanjo

    Chat.cpp - where all the Command Tables are..
    static ChatCommand playerCommandTable[] =
    {
    { "RemoveSickness", '0', &ChatHandler::HandleRemoveRessurectionSickessAuraCommand, "Removes Res Sickness", NULL, 0, 0, 0 },
    { "TeleportList", '0', &ChatHandler::HandleTeleportListCommand, "Gives u a list of Teleport Locations", NULL, 0, 0, 0 },
    { "Go", '0', &ChatHandler::HandleTeleportCommand, "Teleport", NULL, 0, 0, 0 },
    { "Addtele", 'z', &ChatHandler::HandleTeleAddCommand, "Add tele command", NULL, 0, 0, 0 },
    { "Vendor", '0', &ChatHandler::HandleVendorCommand, ".playermenu vendor (1=Spawn)", NULL, 0, 0, 0 },
    { "RemoveVendor", '0', &ChatHandler::HandleDVCommand, "Remove ur Vendor when u are done", NULL, 0, 0, 0 },
    { NULL, '0', NULL, "", NULL, 0, 0, 0 }
    };
    dupe_command_table(playerCommandTable, _playerCommandTable);
    Add to Chat.cpp in the Command Table
    { "playermenu", '0', NULL, "", playerCommandTable, 0, 0, 0 },
    Add in the Bottom of Level3.cpp
    bool ChatHandler::HandleVendorCommand(const char *args, WorldSession *m_session)
    {
    uint32 entry = atol(args);
    if(entry == 0)
    return false;

    CreatureProto * proto = CreatureProtoStorage.LookupEntry(entry);
    CreatureInfo * info = CreatureNameStorage.LookupEntry(entry);
    if(proto == 0 || info == 0)
    {
    RedSystemMessage(m_session, "Invalid entry id.");
    return true;
    }

    Other_Spawn * sp = new Other_Spawn;
    //sp->displayid = info->DisplayID;
    info->GenerateModelId(&sp->displayid);
    sp->entry = 80000;
    sp->form = 0;
    sp->id = objmgr.GenerateCreatureSpawnID();
    sp->movetype = 0;
    sp->x = m_session->GetPlayer()->GetPositionX();
    sp->y = m_session->GetPlayer()->GetPositionY();
    sp->z = m_session->GetPlayer()->GetPositionZ();
    sp->o = m_session->GetPlayer()->GetOrientation();
    sp->emote_state = 0;
    sp->flags = 0;
    sp->factionid = 35;
    sp->bytes0 = 0;
    sp->bytes1 = 0;
    sp->bytes2 = 0;
    //sp->respawnNpcLink = 0;
    sp->stand_state = 0;
    sp->channel_spell=sp->channel_target_creature=sp->channel_target_go=0;


    Creature * p = m_session->GetPlayer()->GetMapMgr()->CreateCreature(entry);
    ASSERT(p);
    p->Load(sp, (uint32)NULL, NULL);
    p->m_loadedFromDB = true;
    p->PushToWorld(m_session->GetPlayer()->GetMapMgr());

    uint32 x = m_session->GetPlayer()->GetMapMgr()->GetPosX(m_session->GetPlayer()->GetPositionX());
    uint32 y = m_session->GetPlayer()->GetMapMgr()->GetPosY(m_session->GetPlayer()->GetPositionY());

    // Add spawn to map
    m_session->GetPlayer()->GetMapMgr()->GetBaseMap()->GetSpawnsListAndCreate(
    x,
    y)->Other_Spawns.push_back(sp);

    MapCell * mCell = m_session->GetPlayer()->GetMapMgr()->GetCell( x, y );

    if( mCell != NULL )
    mCell->SetLoaded();

    BlueSystemMessage(m_session, "Spawned the Vendor", info->Name,
    80000, sp->x, sp->y, sp->z, m_session->GetPlayer()->GetMapId());

    // Save it to the database.
    p->SaveToDB2();

    sGMLog.writefromsession(m_session, "Spawned Vendor", info->Name, m_session->GetPlayer()->GetMapId(),sp->x,sp->y,sp->z);

    return true;
    }

    bool ChatHandler::HandleDVCommand(const char* args, WorldSession *m_session)
    {

    uint64 guid = m_session->GetPlayer()->GetSelection();
    if (guid == 0)
    {
    SystemMessage(m_session, "No selection.");
    return true;
    }

    Creature *unit = m_session->GetPlayer()->GetMapMgr()->GetCreature(GET_LOWGUID_PART(guid));
    if(!unit)
    {
    SystemMessage(m_session, "You should select a creature.");
    return true;
    }
    if ( unit->IsPet() )
    {
    SystemMessage(m_session, "You can't delete a pet." );
    return true;
    }
    sGMLog.writefromsession(m_session, "used npc delete, sqlid %u, creature %s, pos %f %f %f", unit->GetSQL_id2(), unit->GetCreatureInfo() ? unit->GetCreatureInfo()->Name : "wtfbbqhax", unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ());
    if( unit->m_spawns == NULL )
    return false;
    BlueSystemMessage(m_session, "Deleted creature ID %u", unit->spawnid);

    if(unit->IsInWorld())
    {
    if(unit->m_spawns)
    {
    uint32 cellx = uint32(((_maxX-unit->m_spawns->x)/_cellSize));
    uint32 celly = uint32(((_maxY-unit->m_spawns->y)/_cellSize));

    if(cellx <= _sizeX && celly <= _sizeY)
    {
    CellSpawns * sp = unit->GetMapMgr()->GetBaseMap()->GetSpawnsList(cellx, celly);
    if( sp != NULL )
    {
    for( CreatureSpawnList2::iterator itr = sp->Other_Spawns.begin(); itr != sp->Other_Spawns.end(); ++itr )
    if( (*itr) == unit->m_spawns )
    {
    sp->Other_Spawns.erase( itr );
    break;
    }
    }
    delete unit->m_spawns;
    }
    }
    unit->RemoveFromWorld(false,true);
    }
    unit->DeleteFromDB();

    delete unit;

    return true;
    }
    Add in Creatures.cpp [Anywhere]
    void Creature::SaveToDB2()
    {
    if(!spawnid)
    spawnid = objmgr.GenerateCreatureSpawnID();

    std::stringstream ss;
    ss << "REPLACE INTO Other_Spawns VALUES("
    << spawnid << ","
    << GetEntry() << ","
    << GetMapId() << ","
    << m_position.x << ","
    << m_position.y << ","
    << m_position.z << ","
    << m_position.o << ","
    << m_aiInterface->getMoveType() << ","
    << m_uint32Values[UNIT_FIELD_DISPLAYID] << ","
    << m_uint32Values[UNIT_FIELD_FACTIONTEMPLATE] << ","
    << m_uint32Values[UNIT_FIELD_FLAGS] << ","
    << m_uint32Values[UNIT_FIELD_BYTES_0] << ","
    << m_uint32Values[UNIT_FIELD_BYTES_1] << ","
    << m_uint32Values[UNIT_FIELD_BYTES_2] << ","
    << m_uint32Values[UNIT_NPC_EMOTESTATE] << ",0,";
    /*<< ((this->m_spawn ? m_spawn->respawnNpcLink : uint32(0))) << ",";*/

    if(m_spawn)
    ss << m_spawn->channel_spell << "," << m_spawn->channel_target_go << "," << m_spawn->channel_target_creature << ",";
    else
    ss << "0,0,0,";

    ss << uint32(GetStandState()) << ")";
    WorldDatabase.Execute(ss.str().c_str());
    }
    Add in Creature.cpp [Bottom]
    bool Creature::Load(Other_Spawn *spawn, uint32 mode, MapInfo *info)
    {
    m_spawns = spawn;
    proto = CreatureProtoStorage.LookupEntry(spawn->entry);
    if(!proto)
    return false;
    creature_info = CreatureNameStorage.LookupEntry(spawn->entry);
    if(!creature_info)
    return false;

    spawnid = spawn->id;

    m_walkSpeed = m_base_walkSpeed = proto->walk_speed; //set speeds
    m_runSpeed = m_base_runSpeed = proto->run_speed; //set speeds
    m_flySpeed = proto->fly_speed;

    //Set fields
    SetUInt32Value(OBJECT_FIELD_ENTRY,proto->Id);
    SetFloatValue(OBJECT_FIELD_SCALE_X,proto->Scale);

    //SetUInt32Value(UNIT_FIELD_HEALTH, (mode ? long2int32(proto->Health * 1.5) : proto->Health));
    //SetUInt32Value(UNIT_FIELD_BASE_HEALTH, (mode ? long2int32(proto->Health * 1.5) : proto->Health));
    //SetUInt32Value(UNIT_FIELD_MAXHEALTH, (mode ? long2int32(proto->Health * 1.5) : proto->Health));
    uint32 health = proto->MinHealth + RandomUInt(proto->MaxHealth - proto->MinHealth);
    if(mode)
    health = long2int32(double(health) * 1.5);
    SetUInt32Value(UNIT_FIELD_HEALTH, health);
    SetUInt32Value(UNIT_FIELD_MAXHEALTH, health);
    SetUInt32Value(UNIT_FIELD_BASE_HEALTH, health);

    SetUInt32Value(UNIT_FIELD_POWER1,proto->Mana);
    SetUInt32Value(UNIT_FIELD_MAXPOWER1,proto->Mana);
    SetUInt32Value(UNIT_FIELD_BASE_MANA,proto->Mana);

    // Whee, thank you blizz, I love patch 2.2! Later on, we can randomize male/female mobs! xD
    // Determine gender (for voices)
    //if(spawn->displayid != creature_info->Male_DisplayID)
    // setGender(1); // Female

    uint32 model = 0;
    uint32 gender = creature_info->GenerateModelId(&model);
    setGender(gender);

    SetUInt32Value(UNIT_FIELD_DISPLAYID,model);
    SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID,model);
    SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,proto->MountedDisplayID);
    EventModelChange();

    //SetUInt32Value(UNIT_FIELD_LEVEL, (mode ? proto->Level + (info ? info->lvl_mod_a : 0) : proto->Level));
    SetUInt32Value(UNIT_FIELD_LEVEL, proto->MinLevel + (RandomUInt(proto->MaxLevel - proto->MinLevel)));
    if(mode && info)
    ModUnsigned32Value(UNIT_FIELD_LEVEL, min(73 - GetUInt32Value(UNIT_FIELD_LEVEL), info->lvl_mod_a));

    for(uint32 i = 0; i < 7; ++i)
    SetUInt32Value(UNIT_FIELD_RESISTANCES+i,proto->Resistances[i]);

    SetUInt32Value(UNIT_FIELD_BASEATTACKTIME,proto->AttackTime);
    SetFloatValue(UNIT_FIELD_MINDAMAGE, (mode ? proto->MinDamage * 1.5f : proto->MinDamage));
    SetFloatValue(UNIT_FIELD_MAXDAMAGE, (mode ? proto->MaxDamage * 1.5f : proto->MaxDamage));

    SetUInt32Value(UNIT_FIELD_RANGEDATTACKTIME,proto->RangedAttackTime);
    SetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE,proto->RangedMinDamage);
    SetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE,proto->RangedMaxDamage);

    SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY, proto->Item1SlotDisplay);
    SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_01, proto->Item2SlotDisplay);
    SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_DISPLAY_02, proto->Item3SlotDisplay);
    SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, proto->Item1Info1);
    SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_01, proto->Item1Info2);
    SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_02, proto->Item2Info1);
    SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_03, proto->Item2Info2);
    SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_04, proto->Item3Info1);
    SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO_05, proto->Item3Info2);

    SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, spawn->factionid);
    SetUInt32Value(UNIT_FIELD_FLAGS, spawn->flags);
    SetUInt32Value(UNIT_NPC_EMOTESTATE, spawn->emote_state);
    SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, proto->BoundingRadius);
    SetFloatValue(UNIT_FIELD_COMBATREACH, proto->CombatReach);
    original_emotestate = spawn->emote_state;
    // set position
    m_position.ChangeCoords( spawn->x, spawn->y, spawn->z, spawn->o );
    m_spawnLocation.ChangeCoords(spawn->x, spawn->y, spawn->z, spawn->o);
    m_aiInterface->setMoveType(spawn->movetype);
    m_aiInterface->m_waypoints = objmgr.GetWayPointMap(spawn->id);

    m_aiInterface->timed_emotes = objmgr.GetTimedEmoteList(spawn->id);

    m_faction = dbcFactionTemplate.LookupEntry(spawn->factionid);
    if(m_faction)
    {
    m_factionDBC = dbcFaction.LookupEntry(m_faction->Faction);
    // not a neutral creature
    if(!(m_factionDBC->RepListId == -1 && m_faction->HostileMask == 0 && m_faction->FriendlyMask == 0))
    {
    GetAIInterface()->m_canCallForHelp = true;
    }
    }


    //SETUP NPC FLAGS
    SetUInt32Value(UNIT_NPC_FLAGS,proto->NPCFLags);

    if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR ) )
    m_SellItems = objmgr.GetVendorList(GetEntry());

    if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER ) )
    _LoadQuests();

    if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TAXIVENDOR) )
    m_TaxiNode = sTaxiMgr.GetNearestTaxiNode( m_position.x, m_position.y, m_position.z, GetMapId() );

    if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER) || HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_TRAINER_PROF))
    mTrainer = objmgr.GetTrainer(GetEntry());

    if ( HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_AUCTIONEER ) )
    auctionHouse = sAuctionMgr.GetAuctionHouse(GetEntry());

    //NPC FLAGS
    m_aiInterface->m_waypoints=objmgr.GetWayPointMap(spawn->id);

    //load resistances
    for(uint32 x=0;x<7;x++)
    BaseResistance[x]=GetUInt32Value(UNIT_FIELD_RESISTANCES+x);
    for(uint32 x=0;x<5;x++)
    BaseStats[x]=GetUInt32Value(UNIT_FIELD_STAT0+x);

    BaseDamage[0]=GetFloatValue(UNIT_FIELD_MINDAMAGE);
    BaseDamage[1]=GetFloatValue(UNIT_FIELD_MAXDAMAGE);
    BaseOffhandDamage[0]=GetFloatValue(UNIT_FIELD_MINOFFHANDDAMAGE);
    BaseOffhandDamage[1]=GetFloatValue(UNIT_FIELD_MAXOFFHANDDAMAGE);
    BaseRangedDamage[0]=GetFloatValue(UNIT_FIELD_MINRANGEDDAMAGE);
    BaseRangedDamage[1]=GetFloatValue(UNIT_FIELD_MAXRANGEDDAMAGE);
    BaseAttackType=proto->AttackType;

    SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); // better set this one
    SetUInt32Value(UNIT_FIELD_BYTES_0, spawn->bytes0);
    SetUInt32Value(UNIT_FIELD_BYTES_1, spawn->bytes1);
    SetUInt32Value(UNIT_FIELD_BYTES_2, spawn->bytes2);

    ////////////AI

    // kek
    for(list<AI_Spell*>::iterator itr = proto->spells.begin(); itr != proto->spells.end(); ++itr)
    {
    m_aiInterface->addSpellToList(*itr);
    }
    //m_aiInterface->m_canCallForHelp = proto->m_canCallForHelp;
    //m_aiInterface->m_CallForHelpHealth = proto->m_callForHelpHealth;
    m_aiInterface->m_canFlee = proto->m_canFlee;
    m_aiInterface->m_FleeHealth = proto->m_fleeHealth;
    m_aiInterface->m_FleeDuration = proto->m_fleeDuration;

    //these fields are always 0 in db
    GetAIInterface()->setMoveType(0);
    GetAIInterface()->setMoveRunFlag(0);

    // load formation data
    if( spawn->form != NULL )
    {
    m_aiInterface->m_formationLinkSqlId = spawn->form->fol;
    m_aiInterface->m_formationFollowDistance = spawn->form->dist;
    m_aiInterface->m_formationFollowAngle = spawn->form->ang;
    }
    else
    {
    m_aiInterface->m_formationLinkSqlId = 0;
    m_aiInterface->m_formationFollowDistance = 0;
    m_aiInterface->m_formationFollowAngle = 0;
    }

    //////////////AI

    myFamily = dbcCreatureFamily.LookupEntry(creature_info->Family);


    // PLACE FOR DIRTY FIX BASTARDS
    // HACK! set call for help on civ health @ 100%
    if(creature_info->Civilian >= 1)
    m_aiInterface->m_CallForHelpHealth = 100;

    //HACK!
    if(m_uint32Values[UNIT_FIELD_DISPLAYID] == 17743 ||
    m_uint32Values[UNIT_FIELD_DISPLAYID] == 20242 ||
    m_uint32Values[UNIT_FIELD_DISPLAYID] == 15435 ||
    (creature_info->Family == UNIT_TYPE_MISC))
    {
    m_useAI = false;
    }

    /* more hacks! */
    if(proto->Mana != 0)
    SetPowerType(POWER_TYPE_MANA);
    else
    SetPowerType(0);

    has_combat_text = objmgr.HasMonsterSay(GetEntry(), MONSTER_SAY_EVENT_ENTER_COMBAT);
    has_waypoint_text = objmgr.HasMonsterSay(GetEntry(), MONSTER_SAY_EVENT_RANDOM_WAYPOINT);
    m_aiInterface->m_isGuard = isGuard(GetEntry());
    m_aiInterface->m_isNeutralGuard = isNeutralGuard(GetEntry());

    m_aiInterface->getMoveFlags();

    /* creature death state */
    if(proto->death_state == 1)
    {
    uint32 newhealth = m_uint32Values[UNIT_FIELD_HEALTH] / 100;
    if(!newhealth)
    newhealth = 1;
    SetUInt32Value(UNIT_FIELD_HEALTH, 1);
    m_limbostate = true;
    bInvincible = true;
    SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DEAD);
    }
    m_invisFlag = proto->invisibility_type;
    if( spawn->stand_state )
    SetStandState( (uintspawn->stand_state );

    m_aiInterface->EventAiInterfaceParamsetFinish();

    return true;
    }
    Add in ObjectStorage.cpp [Under CreatureSpawns in this void Storage_LoadAdditionalTables()]
    ExtraMapCreatureTables.insert(string("Other_Spawns"));
    Add Under ExtraMapGameObjectTables.insert(string(SecondName)); in objectstorage.cpp
    else if(!stricmp(TableName, "Other_spawns"))
    {
    ExtraMapCreatureTables.insert(string(SecondName));
    return false;
    }
    Add in bottom of RecallCommands.cpp
    bool ChatHandler::HandleTeleportListCommand(const char* args, WorldSession *m_session)
    {
    QueryResult *result = WorldDatabase.Query( "SELECT id,name FROM Teleport ORDER BY name" );
    if(!result)
    return false;
    std::string recout;
    uint32 count = 0;

    recout = "|cff00ff00Recall locations|r:\n\n";
    do
    {
    Field *fields = result->Fetch();
    //float id = fields[0].GetFloat();
    const char * locname = fields[1].GetString();
    recout += "|cff00ccff";
    recout += locname;
    recout += "|r, ";
    count++;

    if(count == 5)
    {
    recout += "\n";
    count = 0;
    }
    }while (result->NextRow());
    SendMultilineMessage(m_session, recout.c_str());

    delete result;
    return true;
    }

    bool ChatHandler::HandleTeleportCommand(const char* args, WorldSession *m_session)
    {
    if( args == NULL )
    return false;

    if( !*args )
    return false;

    if( m_session == NULL )
    return false;

    QueryResult *result = WorldDatabase.Query( "SELECT * FROM Teleport ORDER BY name" );

    if( result == NULL)
    return false;

    do
    {
    Field* fields = result->Fetch();
    const char* locname = fields[1].GetString();
    uint32 locmap = fields[2].GetUInt32();
    float x = fields[3].GetFloat();
    float y = fields[4].GetFloat();
    float z = fields[5].GetFloat();

    if( strnicmp( const_cast< char* >( args ), locname, strlen( args ) ) == 0 )
    {
    if( m_session->GetPlayer() != NULL )
    {
    m_session->GetPlayer()->SafeTeleport(locmap, 0, LocationVector(x, y, z));
    delete result;
    return true;
    }
    else
    {
    delete result;
    return false;
    }
    }

    }while (result->NextRow());

    delete result;
    return false;
    }

    bool ChatHandler::HandleTeleAddCommand(const char* args, WorldSession *m_session)
    {
    if(!*args)
    return false;

    QueryResult *result = WorldDatabase.Query( "SELECT name FROM Teleport" );
    if(!result)
    return false;
    do
    {
    Field *fields = result->Fetch();
    const char * locname = fields[0].GetString();
    if (strncmp((char*)args,locname,strlen(locname))==0)
    {
    RedSystemMessage(m_session, "Name in use, please use another name for your location.");
    delete result;
    return true;
    }
    }while (result->NextRow());
    delete result;

    Player* plr = m_session->GetPlayer();
    std::stringstream ss;

    string rc_locname = string(args);

    ss << "INSERT INTO Teleport (name, mapid, positionX, positionY, positionZ) VALUES ('"
    << WorldDatabase.EscapeString(rc_locname).c_str() << "' , "
    << plr->GetMapId() << ", "
    << plr->GetPositionX() << ", "
    << plr->GetPositionY() << ", "
    << plr->GetPositionZ() << ");";
    WorldDatabase.Execute( ss.str( ).c_str( ) );

    char buf[256];
    snprintf((char*)buf, 256, "Added location to DB with MapID: %d, X: %f, Y: %f, Z: %f",
    (unsigned int)plr->GetMapId(), plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ());
    GreenSystemMessage(m_session, buf);
    sGMLog.writefromsession(m_session, "used Tele add, added \"%s\" location to database.", rc_locname.c_str());

    return true;
    }
    Add in Chat.h under Level 0 Commands
    bool HandleTeleportListCommand(const char* args, WorldSession *m_session);
    bool HandleTeleportCommand(const char* args, WorldSession *m_session);
    bool HandleTeleAddCommand(const char* args, WorldSession *m_session);
    bool HandleVendorCommand(const char* args, WorldSession *m_session);
    bool HandleDVCommand(const char* args, WorldSession *m_session);
    Add in Chat.h Under CommandTableStorage
    ChatCommand* _playerCommandTable;
    Add in Chat.cpp Under GetSubCommand
    else if(!strcmp(name, "playermenu"))
    return _playerCommandTable;
    return 0;
    Add in map.h under } GOSpawn;
    typedef struct
    {
    uint32 id;//spawn ID
    uint32 entry;
    float x;
    float y;
    float z;
    float o;
    Formation* form;
    uint8 movetype;
    uint32 displayid;
    uint32 factionid;
    uint32 flags;
    uint32 bytes0;
    uint32 bytes1;
    uint32 bytes2;
    uint32 emote_state;
    //uint32 respawnNpcLink;
    uint16 channel_spell;
    uint32 channel_target_go;
    uint32 channel_target_creature;
    uint16 stand_state;
    }Other_Spawn;
    Add in Map.h under Gospawnlist;
    typedef std::vector<Other_Spawn*> CreatureSpawnList2;
    add in map.h under CreatureSpawnList CreatureSpawns;
    CreatureSpawnList2 Other_Spawns;
    add in map.h under uint32 CreatureSpawnCount;
    uint32 Other_SpawnCount;
    add in map.cpp under for ( GOSpawnList::iterator it =
    for ( CreatureSpawnList2::iterator i = sp->Other_Spawns.begin(); i != sp->Other_Spawns.end(); i++ )
    delete (*i);
    Add under Map.cpp over }

    Log.Notice("Map", "%u creatures / %u gameobjects on map %u cached.", CreatureSpawnCount, GameObjectSpawnCount, _mapId);
    }
    QueryResult * result;
    set<string>::iterator tableiterator;
    for(tableiterator=ExtraMapCreatureTables.begin(); tableiterator!=ExtraMapCreatureTables.end();++tableiterator)
    {
    result = WorldDatabase.Query("SELECT * FROM %s WHERE Map = %u",(*tableiterator).c_str(),this->_mapId);
    if(result)
    {
    if(CheckResultLengthCreatures( result) )
    {
    do{
    Field * fields = result->Fetch();
    Other_Spawn * cspawn = new Other_Spawn;
    cspawn->id = fields[0].GetUInt32();
    cspawn->form = FormationMgr::getSingleton().GetFormation(cspawn->id);
    cspawn->entry = fields[1].GetUInt32();
    cspawn->x = fields[3].GetFloat();
    cspawn->y = fields[4].GetFloat();
    cspawn->z = fields[5].GetFloat();
    cspawn->o = fields[6].GetFloat();
    /*uint32 cellx=float2int32(((_maxX-cspawn->x)/_cellSize));
    uint32 celly=float2int32(((_maxY-cspawn->y)/_cellSize));*/
    uint32 cellx=CellHandler<MapMgr>::GetPosX(cspawn->x);
    uint32 celly=CellHandler<MapMgr>::GetPosY(cspawn->y);
    if(spawns[cellx]==NULL)
    {
    spawns[cellx]=new CellSpawns*[_sizeY];
    memset(spawns[cellx],0,sizeof(CellSpawns*)*_sizeY);
    }

    if(!spawns[cellx][celly])
    spawns[cellx][celly]=new CellSpawns;
    cspawn->movetype = fields[7].GetUInt8();
    cspawn->displayid = fields[8].GetUInt32();
    cspawn->factionid = fields[9].GetUInt32();
    cspawn->flags = fields[10].GetUInt32();
    cspawn->bytes0 = fields[11].GetUInt32();
    cspawn->bytes1 = fields[12].GetUInt32();
    cspawn->bytes2 = fields[13].GetUInt32();
    cspawn->emote_state = fields[14].GetUInt32();
    //cspawn->respawnNpcLink = fields[15].GetUInt32();
    cspawn->channel_spell = fields[16].GetUInt16();
    cspawn->channel_target_go = fields[17].GetUInt32();
    cspawn->channel_target_creature = fields[18].GetUInt32();
    cspawn->stand_state = fields[19].GetUInt16();
    spawns[cellx][celly]->Other_Spawns.push_back(cspawn);
    ++Other_SpawnCount;
    }while(result->NextRow());
    }

    }

    delete result;
    }

    result = WorldDatabase.Query("SELECT * FROM Other_staticspawns WHERE Map = %u",this->_mapId);
    if(result)
    {
    if( CheckResultLengthCreatures(result) )
    {
    do{
    Field * fields = result->Fetch();
    Other_Spawn * cspawn = new Other_Spawn;
    cspawn->id = fields[0].GetUInt32();
    cspawn->form = FormationMgr::getSingleton().GetFormation(cspawn->id);
    cspawn->entry = fields[1].GetUInt32();
    cspawn->x = fields[3].GetFloat();
    cspawn->y = fields[4].GetFloat();
    cspawn->z = fields[5].GetFloat();
    cspawn->o = fields[6].GetFloat();
    cspawn->movetype = fields[7].GetUInt8();
    cspawn->displayid = fields[8].GetUInt32();
    cspawn->factionid = fields[9].GetUInt32();
    cspawn->flags = fields[10].GetUInt32();
    cspawn->bytes0 = fields[11].GetUInt32();
    cspawn->bytes1 = fields[12].GetUInt32();
    cspawn->bytes2 = fields[13].GetUInt32();
    cspawn->emote_state = fields[14].GetUInt32();
    //cspawn->respawnNpcLink = fields[15].GetUInt32();
    cspawn->channel_spell=0;
    cspawn->channel_target_creature=0;
    cspawn->channel_target_go=0;
    cspawn->stand_state = fields[19].GetUInt16();
    staticSpawns.Other_Spawns.push_back(cspawn);
    ++Other_SpawnCount;
    }while(result->NextRow());
    }

    delete result;
    }
    Add this to a Txt file and save it as Sql
    and add it to ur DB.
    Also. always have 1 TeleportCommand in Teleport Table, or else u cant addtele from ingame
    CREATE TABLE `teleport` (
    `id` bigint(20) unsigned NOT NULL auto_increment,
    `name` varchar(100) NOT NULL,
    `MapId` int(10) unsigned NOT NULL default '0',
    `positionX` float NOT NULL default '0',
    `positionY` float NOT NULL default '0',
    `positionZ` float NOT NULL default '0',
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM AUTO_INCREMENT=800 DEFAULT CHARSET=utf8 COMMENT='Tele Command';
    INSERT INTO `teleport` VALUES ('799', 'Stormwind', '0', '-8909.42', '556.026', '93.5676');
    CREATE TABLE `other_spawns` (
    `id` int(11) unsigned NOT NULL auto_increment,
    `entry` int(30) NOT NULL,
    `map` int(30) NOT NULL,
    `position_x` float NOT NULL,
    `position_y` float NOT NULL,
    `position_z` float NOT NULL,
    `orientation` float NOT NULL,
    `movetype` int(30) NOT NULL default '0',
    `displayid` int(30) unsigned NOT NULL default '0',
    `faction` int(30) NOT NULL default '14',
    `flags` int(30) NOT NULL default '0',
    `bytes0` int(30) NOT NULL default '0',
    `bytes1` int(30) NOT NULL default '0',
    `bytes2` int(30) NOT NULL default '0',
    `emote_state` int(30) NOT NULL default '0',
    `npc_respawn_link` int(30) NOT NULL default '0',
    `channel_spell` int(30) NOT NULL default '0',
    `channel_target_sqlid` int(30) NOT NULL default '0',
    `channel_target_sqlid_creature` int(30) NOT NULL default '0',
    `standstate` int(10) NOT NULL default '0',
    PRIMARY KEY (`id`),
    KEY `b` (`map`)
    ) ENGINE=MyISAM AUTO_INCREMENT=4661362 DEFAULT CHARSET=latin1 COMMENT='Spawn System';
    CREATE TABLE `other_staticspawns` (
    `id` int(30) unsigned NOT NULL auto_increment,
    `entry` int(30) NOT NULL,
    `Map` int(30) NOT NULL,
    `x` float NOT NULL,
    `y` float NOT NULL,
    `z` float NOT NULL,
    `o` float NOT NULL,
    `movetype` int(30) NOT NULL default '0',
    `displayid` int(30) unsigned NOT NULL default '0',
    `factionid` int(30) NOT NULL default '35',
    `flags` int(30) NOT NULL default '0',
    `bytes` int(30) NOT NULL default '0',
    `bytes2` int(30) NOT NULL default '0',
    `emote_state` int(30) NOT NULL default '0',
    `npc_respawn_link` int(30) NOT NULL default '0',
    PRIMARY KEY (`id`),
    UNIQUE KEY `id` (`id`),
    KEY `a` (`Map`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Spawn System';
    Last edited by shanjo; 11-08-2008 at 09:45 AM.

    [Release] Playermenu
  2. #2
    Ground Zero's Avatar ★ Elder ★
    Reputation
    1132
    Join Date
    Aug 2008
    Posts
    3,504
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    And.....you made this yourself? Looks good, Tried and Working +Rep
    Last edited by Ground Zero; 12-03-2008 at 01:32 PM.

  3. #3
    shanjo's Avatar Member
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes ?.

    Its not that hard ?. Tho it took alot of time, made alot of things, just never Released anything before.

  4. #4
    Snailz's Avatar Contributor Authenticator enabled
    Reputation
    239
    Join Date
    Nov 2007
    Posts
    941
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is an alright job. +rep
    Cheese Cake?

  5. #5
    shanjo's Avatar Member
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank u.. (:

  6. #6
    Etna's Avatar Banned
    Reputation
    20
    Join Date
    Sep 2007
    Posts
    349
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe Ths was NICE mate !

  7. #7
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    150/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I like it a lot!
    People who don't believe you because if low rep sould be shot, well maybe not shot but you get the idea +Rep

  8. #8
    shanjo's Avatar Member
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yea hehe (:

    Im trying to Make a Command that Spawns an Vendor then when on_leave it will despawn the Npc. (:

    [The Vendor will ofc. be sql based so peeps can change the things he sells (:]

  9. #9
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    150/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Ermmm, to do it in Lua:

    Code:
     
    x = Unit:GetX();
    y = Unit:GetY();
    z = Unit:GetZ();
    o = Unit:GetO();
    x = x + 2
    y = y + 2
    z = z + 1
    Unit:SpawnCreature(22997, x, y, z, o, 17, 45000);
    The first 4 lines get the coords of where the npc is actually at.
    x = x +2 and y, change where you go. So if i say, i add 2 to x, then it will spawn 2 yards to the left. The z is how high, I always add one just in case it spawns under a mountain etc. You then spawn the npc (changing unit to your function ofc); the 22997 is the code of the npc, x y z o is the coords it's using, 17 is the faction and finnaly, 45000 is for how long the npc spawns for (1000 = 1 second). If you spawn it close to the creature then when it leaves combat it will despawn depending on how long you spawned it for, but it means that people cant talk to it while out of combat if it's close. Good luck!

  10. #10
    shanjo's Avatar Member
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well.. gave up in to do it in lua, thinks its easier in C++, plus its a bit better in C++ don't u think (: ?

    Im doing so the Player can remove the Npc by himself when he is done, but he can only remove the vendor, not others..

    also. he can spawn the vendor with the use of this command

    .playermenu vendor (1 = Spawns 0 = Dont spawn, also 2+ numbers and it will say invalid id or somthing like that.)

    Post if u get errors..

    [Im not 100% that i got everything in, but can't remember anymore .. its alot of codes so (:]

    Updated..

    Vendor Spawn and Vendor Deletions have been added..
    Last edited by shanjo; 11-08-2008 at 09:59 AM. Reason: Updated

  11. #11
    shanjo's Avatar Member
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Developer + Donor Menu Added

    When u are a donor u now have <Donor> infront of ur name instead
    and developer have <Developer>

    Goto TCOF - Powered by vBulletin to read changeset and see what else im doing
    and for updates [They will be posted there in the future.]

    svn = http://svn2.assembla.com/svn/tcof/

  12. #12
    obionekanobi123's Avatar Member
    Reputation
    1
    Join Date
    Mar 2008
    Posts
    64
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can ya post donar menu to?

  13. #13
    shanjo's Avatar Member
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My com ****t. so had to start it all over again, but im making em again right now, will post a Repack that Installs Playermenu, DeveloperMenu and DonorMenu

    [I can put a Database in it that have all weapon speed reduced by 0.3 ?] or maybe the just the update patch i made that will make em 0.3 faster

  14. #14
    sammiboy's Avatar Member
    Reputation
    10
    Join Date
    May 2007
    Posts
    65
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is awesome mate, really ... Good job.

    +Rep If I can.
    Also Knowned as Samloo


  15. #15
    Sounddead's Avatar Contributor
    Reputation
    160
    Join Date
    Sep 2007
    Posts
    1,126
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looking cool.

    It would be better if you could make it a patch file though.

    I live in a shoe

Similar Threads

  1. [Release] Herbs to flag
    By Dave-evad in forum World of Warcraft Model Editing
    Replies: 9
    Last Post: 11-26-2006, 03:31 PM
  2. Burning Crusdade Release Date!
    By codydude815 in forum World of Warcraft General
    Replies: 22
    Last Post: 10-30-2006, 01:59 PM
  3. Burning Crusdade Release Date!
    By codydude815 in forum World of Warcraft Guides
    Replies: 15
    Last Post: 10-28-2006, 12:15 PM
  4. anti-warden Release #1
    By zhPaul in forum World of Warcraft Bots and Programs
    Replies: 40
    Last Post: 10-21-2006, 01:40 AM
  5. Burning Crusade Release
    By KOLOSSAL in forum World of Warcraft General
    Replies: 3
    Last Post: 10-10-2006, 12:33 AM
All times are GMT -5. The time now is 08:08 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search