Results 1 to 15 of 15
  1. #1
    Corporal
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    CoreCoins
    0

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)

    [Release] Playermenu



    Donate to Remove Ads, Get ShoutBawx - Elite Forum Access
    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.

  2. #2
    KuRLoS > KuRIoS

    CoreCoins User

    Ground Zero's Avatar
    Reputation
    1106
    Join Date
    Aug 2008
    Location
    Great Britain
    Posts
    3,483
    Blog Entries
    1
    CoreCoins
    38024

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    And.....you made this yourself? Looks good, Tried and Working +Rep
    Last edited by Ground Zero; 12-03-2008 at 01:32 PM.

    If you're unsure about anything don't hesitate to PM me.

  3. #3
    Corporal
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    CoreCoins
    0

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    Yes ?.

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

  4. #4
    Contributor
    Snailz's Avatar
    Reputation
    239
    Join Date
    Nov 2007
    Location
    Snail land
    Posts
    941
    CoreCoins
    1

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    This is an alright job. +rep
    Cheese Cake?

  5. #5
    Corporal
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    CoreCoins
    0

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    Thank u.. (:

  6. #6
    Banned
    Reputation
    20
    Join Date
    Sep 2007
    Location
    Sweden
    Posts
    349
    CoreCoins
    0

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    hehe Ths was NICE mate !

  7. #7
    Innovation & Emulation My CoreCoins User Title

    stoneharry's Avatar
    Reputation
    1255
    Join Date
    Sep 2007
    Location
    Great Britain
    Posts
    3,905
    Blog Entries
    6
    CoreCoins
    62

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    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
    Corporal
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    CoreCoins
    0

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    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
    Innovation & Emulation My CoreCoins User Title

    stoneharry's Avatar
    Reputation
    1255
    Join Date
    Sep 2007
    Location
    Great Britain
    Posts
    3,905
    Blog Entries
    6
    CoreCoins
    62

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    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
    Corporal
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    CoreCoins
    0

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    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
    Corporal
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    CoreCoins
    0

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    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
    New User

    Reputation
    1
    Join Date
    Mar 2008
    Location
    Deadmines
    Posts
    64
    CoreCoins
    0

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    can ya post donar menu to?

  13. #13
    Corporal
    Reputation
    11
    Join Date
    Oct 2007
    Posts
    17
    CoreCoins
    0

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    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
    Sergeant sammiboy's Avatar
    Reputation
    10
    Join Date
    May 2007
    Location
    Sweden ofcourse?
    Posts
    65
    CoreCoins
    0

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    This is awesome mate, really ... Good job.

    +Rep If I can.
    Also Knowned as Samloo


  15. #15
    Contributor
    Sounddead's Avatar
    Reputation
    160
    Join Date
    Sep 2007
    Location
    Canada
    Posts
    1,132
    CoreCoins
    1

    Trade Feedbacks

    Status
    n/a
    Positive
    0 (0%)
    Negative
    0 (0%)
    Looking cool.

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

    I live in a shoe

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -4. The time now is 07:47 AM. Powered by vBulletin® Version 4.2.0
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Content Relevant URLs by vBSEO Resources saved on this page: MySQL 21.43%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113