tim
Members-
Posts
41 -
Joined
-
Last visited
Never -
Donations
0.00 GBP
Content Type
Profiles
Bug Tracker
Wiki
Release Notes
Forums
Downloads
Blogs
Events
Everything posted by tim
-
Hi Guys i have taken this from Trinity and make it working on mangos. The problem what i have is where and how do i reset the streak for Player if he hit alt F4 or logout button ingame ? void Player::SendKillStreak(Player* pKiller, Player* pVictim) { if(!sWorld.getConfig(CONFIG_BOOL_KILLSTREAK_ENABLE)) return; uint8 MapRestriction = sWorld.getConfig(CONFIG_FLOAT_KILLSTREAK_RESTRICTION); if( MapRestriction == 1 && !InBattleGround() && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) || MapRestriction == 2 && !HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP) || MapRestriction == 3 && !InBattleGround()) return; uint32 goldAmount = sWorld.getConfig(CONFIG_FLOAT_KILLSTREAK_GOLD); uint32 RewardedForKillingSameP = sWorld.getConfig(CONFIG_FLOAT_KILLSTREAK_SAME_PLAYER); //Name speaks for It self. uint32 AmountOfRewardsOnKillStreak[5] = { 2, 3, 4, 5, 6 }; // Killstreak Steps const uint32 KillerStreak1 = 1; const uint32 KillerStreak2 = 2; const uint32 KillerStreak3 = 3; const uint32 KillerStreak4 = 4; const uint32 KillerStreak5 = 5; uint32 KillStreaks[5] = { KillerStreak1, KillerStreak2, KillerStreak3, KillerStreak4, KillerStreak5, }; struct SystemInfo { uint32 KillStreak; uint64 LastGUIDKill; uint8 KillCount; }; static std::map<uint32, SystemInfo> KillingStreak; uint64 kGUID; uint64 vGUID; char msg[500]; kGUID = pKiller->GetGUID(); vGUID = pVictim->GetGUID(); if(kGUID == vGUID) { return; } if(KillingStreak[kGUID].LastGUIDKill == vGUID) { KillingStreak[kGUID].KillCount++; KillingStreak[vGUID].KillCount = 1; } if(KillingStreak[kGUID].LastGUIDKill != vGUID) { KillingStreak[kGUID].KillCount = 1; KillingStreak[vGUID].KillCount = 1; } // 3 kills same player anouncer to killer if(KillingStreak[kGUID].KillCount == 3) { std::ostringstream msg; std::ostringstream KillerName; std::ostringstream KilledName; std::string pVictimColor = "|cFF008000"; std::string AreaColor = "|CFFFE8A0E"; KillerName << pKiller->GetName(); KilledName << pVictim->GetName(); std::ostringstream Kills; msg << AreaColor << "[PvP-"<< pKiller->GetMap()->GetMapName() << "] " << "|cffffffff == You pwned == " << KilledName.str().c_str(); ChatHandler(this).SendSysMessage(msg.str().c_str()); } // 3 kills same player anouncer to victim if(KillingStreak[kGUID].KillCount == 3) { std::ostringstream msg; std::ostringstream KillerName; std::ostringstream KilledName; std::string pVictimColor = "|cFF008000"; std::string AreaColor = "|CFFFE8A0E"; KillerName << pKiller->GetName(); KilledName << pVictim->GetName(); std::ostringstream Kills; msg << AreaColor << "[PvP-"<< pKiller->GetMap()->GetMapName() << "] " << "|cffffffff == You get pwned by == " << KillerName.str().c_str(); ChatHandler(pVictim).SendSysMessage(msg.str().c_str()); } if(KillingStreak[kGUID].KillCount >= RewardedForKillingSameP) { return; } KillingStreak[kGUID].KillStreak++; KillingStreak[vGUID].KillStreak = 0; KillingStreak[kGUID].LastGUIDKill = vGUID; KillingStreak[vGUID].LastGUIDKill = 0; if(goldAmount > 0) { int hntmn = goldAmount+(KillingStreak[kGUID].KillStreak)*1000; // set the varables for our string int buffer, goldAmount = hntmn / 10000, silv = (hntmn % 10000) / 1000, copp = (hntmn % 10000) % 100; char const *addgoldstr; std::stringstream ss; std::string AreaColor = "|CFFFE8A0E"; // build our string ss << AreaColor << "[PvP-"<< pKiller->GetMap()->GetMapName() << "] |cffffffff You recieve " << goldAmount << "." << silv << "" << copp << " gold for killing " << pVictim->GetName() << "."; // conver string to const chr std::string addgoldcstr = ss.str(); addgoldstr = addgoldcstr.c_str(); // send the player the gold pKiller->ModifyMoney(hntmn); SaveGoldToDB(); // send the player the message ChatHandler(this).SendSysMessage(addgoldstr); } switch(KillingStreak[kGUID].KillStreak) { case KillerStreak1: // geht das hier so??????? sprintf(msg, "%s has a %u killing-spree. ", pKiller->GetName(), KillerStreak1); //sWorld.SendWorldText(LANG_SYSTEMMESSAGE, msg); ChatHandler(this).SendSysMessage(msg); { //we Cast Illusion Test here pKiller->CastSpell(pKiller, 37806, false); } break; case KillerStreak2: case KillerStreak3: } }
-
The LFG part from Rsa dont work at the moment is still under development
-
i extract the mmpas but if i look inside the task manger i see progress is extracting only with 25% of my cpu power is there a chance to set this up because it takes a long time to extract this.
-
yes you can exlude them in config but if you have these option on the bot sell these items but these items should never go to auction so best way i think is a config option to exlude special items in a sting
-
Hi Guys ! I am not sure but i think we have to secure that the bot dont sell items like. http://www.wowhead.com/item=192 http://www.wowhead.com/item=17 http://www.wowhead.com/item=12064 http://www.wowhead.com/item=2586 http://www.wowhead.com/item=11508 http://www.wowhead.com/item=23162
-
I have a problem if i search characters they show me up results but if i klick on 1 character to show me the items i got error that armory cant show the character
-
I wrote a little patch now the Question is this the right way to insert this to code ? commit 898f02a4744b29c770f1d89256b04c46b82257c8 Author: tim4 <123 @test.de> Date: Wed Jan 12 08:10:55 2011 +0100 Timed LVL up Patch Signed-off-by: tim4 <123 @test.de> diff --git a/src/game/Language.h b/src/game/Language.h index eeba52b..b957d55 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -909,8 +909,9 @@ enum MangosStrings // 10000-10999 // Use for custom patches 11000-11999 + LANG_LP_RUPT_MESSAGE = 11100,//WLK RP LUPT system v0.3M - message - // NOT RESERVED IDS 12000-1999999999 + // NOT RESERVED IDS 12000-1999999999 // `db_script_string` table index 2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID) // For other tables maybe 2000010000-2147483647 (max index) }; diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index a37b6fc..2ffefb3 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -35,6 +35,7 @@ #include "Opcodes.h" #include "ObjectGuid.h" #include "World.h" +#include "Language.h" // WLK RP LUPT system v0.3 - MaNGOS #include <cmath> @@ -102,8 +103,7 @@ ObjectAccessor::FindPlayerByName(const char *name) return NULL; } -void -ObjectAccessor::SaveAllPlayers() +void ObjectAccessor::SaveAllPlayers() { HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock()); HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers(); @@ -111,6 +111,72 @@ ObjectAccessor::SaveAllPlayers() itr->second->SaveToDB(); } +void ObjectAccessor::PlayerLevelByTime() // WLK RP LUPT system v0.3M +{ + uint8 confMaxLevel = sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL); + uint8 confAgeForLevel = sWorld.getConfig(CONFIG_UINT32_RP_LUPT_AGE_FOR_LEVEL); + bool confMsgEnabled = sWorld.getConfig(CONFIG_BOOL_RP_LUPT_MSG_ENABLED); + + HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock()); + HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers(); + for (HashMapHolder<Player>::MapType::iterator iter = m.begin(); iter != m.end(); ++iter) + { + // If player is online & has played time + if (iter->second->IsInWorld() && iter->second->GetLevelPlayedTime() >= confAgeForLevel) + { + // If player isn't in AFK mode & isn't in combat & is alive & has lower level than max level + if(!iter->second->isAFK() && !iter->second->isInCombat() && iter->second->isAlive() && + iter->second->getLevel() < confMaxLevel) + { + uint8 level = iter->second->getLevel() + 1; + + iter->second->GiveLevel(level); // Give new level + iter->second->InitTalentForLevel(); // Init talents for new level + iter->second->SetUInt32Value(PLAYER_XP, 0); // Reset XP bar + iter->second->SaveToDB(true); // Save player to DB (now works properly) + + // RP LUPT system v0.3 - system messages + if(confMsgEnabled) + { + std::stringstream ss; + uint32 bytes = 0; + bytes |= uint8(level); // level + bytes |= uint8(iter->second->getRace()) << 8; // race + bytes |= uint8(iter->second->getClass()) << 16; // class + + if(!sWorld.GetLuptMessagesData(bytes)) + { + bytes = 0; // reset byte value + bytes |= uint8(level); // level + bytes |= uint8(-1) << 8; // all races + bytes |= uint8(-1) << 16; // all classes + if(!sWorld.GetLuptMessagesData(bytes)) + return; + } + + ss << iter->second->GetName() << ": " << sWorld.GetLuptMessagesData(bytes)->msgText; + + switch(sWorld.GetLuptMessagesData(bytes)->msgType) + { + case 1: + sWorld.SendWorldText(LANG_LP_RUPT_MESSAGE, ss.str().c_str()); + break; + case 2: + sWorld.SendServerMessage(SERVER_MSG_CUSTOM, ss.str().c_str(), NULL); + break; + case 3: + sWorld.SendWorldText(LANG_LP_RUPT_MESSAGE, ss.str().c_str()); + sWorld.SendServerMessage(SERVER_MSG_CUSTOM, ss.str().c_str(), NULL); + break; + default: + break; + } + } + } + } + } +} + void ObjectAccessor::KickPlayer(ObjectGuid guid) { if (Player* p = HashMapHolder<Player>::Find(guid)) diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 5307b70..66802a9 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -119,7 +119,8 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor, } void SaveAllPlayers(); - + void PlayerLevelByTime(); // WLK RP LUPT system v0.3M + // Pet access static Pet* FindPet(ObjectGuid guid); // if need pet at specific map better use Map::GetPet diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a23d4b1..93f5e94 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17451,13 +17451,21 @@ bool Player::_LoadHomeBind(QueryResult *result) /*** SAVE SYSTEM ***/ /*********************************************************/ -void Player::SaveToDB() -{ - // we should assure this: ASSERT((m_nextSave != sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE))); - // delay auto save at any saves (manual, in code, or autosave) - m_nextSave = sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE); - - //lets allow only players in world to be saved +void Player::SaveToDB(bool rp_lupt) +{ + // we should assure this: ASSERT((m_nextSave != sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE))); + // delay auto save at any saves (manual, in code, or autosave) + + if(!rp_lupt) // WLK RP LUPT system - Autosave system FIX + { + m_nextSave = sWorld.getConfig(CONFIG_UINT32_INTERVAL_SAVE); + } + else // WLK log report if player saved by RP LUPT system + { + sLog.outString("RP LUPT: ACC:%u GUID:%u Name:%s has reached level %u and was stored to DB.", + GetSession()->GetAccountId(), GetGUIDLow(), m_name.c_str(), getLevel()); + } + //lets allow only players in world to be saved if(IsBeingTeleportedFar()) { ScheduleDelayedOperation(DELAYED_SAVE_PLAYER); diff --git a/src/game/Player.h b/src/game/Player.h index 78edcb2..c29013a 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1558,8 +1558,8 @@ class MANGOS_DLL_SPEC Player : public Unit /*** SAVE SYSTEM ***/ /*********************************************************/ - void SaveToDB(); - void SaveInventoryAndGoldToDB(); // fast save function for item/money cheating preventing + void SaveToDB(bool rp_lupt = false); // WLK RP LUPT system v0.3M - Autosave system FIX + void SaveInventoryAndGoldToDB(); // fast save function for item/money cheating preventing void SaveGoldToDB(); void SaveDataFieldToDB(); static bool SaveValuesArrayInDB(Tokens const& data,uint64 guid); diff --git a/src/game/World.cpp b/src/game/World.cpp index f6fb0fb..5b82003 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -66,6 +66,7 @@ #include "AuctionHouseBot/AuctionHouseBot.h" #include "CharacterDatabaseCleaner.h" #include "Language.h" +#include "ProgressBar.h" // WLK RP LUPT system v0.3M INSTANTIATE_SINGLETON_1( World ); @@ -178,10 +179,21 @@ Player* World::FindPlayerInZone(uint32 zone) // Used by the weather system. We return the player to broadcast the change weather message to him and all players in the zone. return player; } + } return NULL; } +void World::SetRpLuptTableName(const std::string& rpluptTable) // WLK RP LUPT system v0.3M - Sets a name of the message table +{ + m_rpluptTable = rpluptTable; +} + +const char* World::GetRpLuptTableName() const // WLK RP LUPT system v0.3M - Returns a name of the message table +{ + return m_rpluptTable.c_str(); +} + /// Find a session by its id WorldSession* World::FindSession(uint32 id) const { @@ -917,6 +929,12 @@ void World::LoadConfigSettings(bool reload) sLog.outString( "WORLD: VMap support included. LineOfSight:%i, getHeight:%i, indoorCheck:%i", enableLOS, enableHeight, getConfig(CONFIG_BOOL_VMAP_INDOOR_CHECK) ? 1 : 0); sLog.outString( "WORLD: VMap data directory is: %svmaps",m_dataPath.c_str()); + // WLK RP LUPT config + setConfig(CONFIG_BOOL_RP_LUPT, "RP_LUPT.On", false); // v0.3M + setConfig(CONFIG_UINT32_RP_LUPT_CHECK_INTERVAL, "RP_LUPT.CheckInterval", 60); // v0.3M + setConfig(CONFIG_UINT32_RP_LUPT_AGE_FOR_LEVEL, "RP_LUPT.AgeForLevel", 3600); // v0.3M + setConfig(CONFIG_BOOL_RP_LUPT_MSG_ENABLED, "RP_LUPT.MessagesOn", false); // v0.3M + SetRpLuptTableName(sConfig.GetStringDefault("RP_LUPT.MessageDbTable", "")); // v0.3M // Darkrulerz' Customs setConfig(CONFIG_UINT32_BASE_PET_SCALE , "Custom.PetScale" , 1); @@ -1295,6 +1313,10 @@ void World::SetInitialWorldSettings() sLog.outString( "Returning old mails..." ); sObjectMgr.ReturnOrDeleteOldMails(false); + ///- WLK RP LUPT system v0.3M - Load system messages + sLog.outString("Loading RP LUPT System Messages..."); + LoadLuptMessages(); + ///- Load and initialize scripts sLog.outString( "Loading Scripts..." ); sLog.outString(); @@ -1363,6 +1385,7 @@ void World::SetInitialWorldSettings() m_timers[WUPDATE_EXT_MAIL].SetInterval(m_configUint32Values[CONFIG_UINT32_EXTERNAL_MAIL_INTERVAL] * MINUTE * IN_MILLISECONDS); // External mail m_timers[WUPDATE_DELETECHARS].SetInterval(DAY*IN_MILLISECONDS); // check for chars to delete every day m_timers[WUPDATE_AUTOBROADCAST].SetInterval(abtimer); + m_timers[WUPDATE_RP_LUPT].SetInterval(getConfig(CONFIG_UINT32_RP_LUPT_CHECK_INTERVAL)*IN_MILLISECONDS); // WLK RP LUPT v0.3M // for AhBot m_timers[WUPDATE_AHBOT].SetInterval(20*IN_MILLISECONDS); // every 20 sec @@ -1481,6 +1504,40 @@ void World::DetectDBCLang() sLog.outString(); } +void World::LoadLuptMessages() // WLK RP LUPT system v0.3M - Loads system messages +{ + uint32 count = 0; + // 0 1 2 3 4 + QueryResult *result = WorldDatabase.PQuery("SELECT level, type, race, class, message FROM %s", sWorld.GetRpLuptTableName()); + + if(result) + { + barGoLink bar(result->GetRowCount()); + do + { + bar.step(); + Field *fields = result->Fetch(); + uint32 bytes = 0; + bytes |= fields[0].GetUInt8(); // level + bytes |= fields[2].GetUInt8() << 8; // race + bytes |= fields[3].GetUInt8() << 16; // class + LuptMessagesData lmd; + lmd.msgType = fields[1].GetUInt8(); // Message type + lmd.msgText = fields[4].GetCppString(); // Message text + mLuptMessagesData[bytes] = lmd; + count++; + } while (result->NextRow()); + } + else + { + barGoLink bar(1); + bar.step(); + } + sLog.outString(">> Loaded %u RP LUPT system messages", count); + sLog.outString(); + return; +} + /// Update the World ! void World::Update(uint32 diff) { @@ -1622,6 +1679,15 @@ void World::Update(uint32 diff) SendBroadcast(); } } + ///- WLK RP LUPT v0.3M - fce call + if (sWorld.getConfig(CONFIG_BOOL_RP_LUPT)) + { + if (m_timers[WUPDATE_RP_LUPT].Passed()) + { + m_timers[WUPDATE_RP_LUPT].Reset(); + sObjectAccessor.PlayerLevelByTime(); + } + } ///- Process External Mail Queue when necessary if(m_configBoolValues[CONFIG_BOOL_EXTERNAL_MAIL_ENABLED] && m_timers[WUPDATE_EXT_MAIL].Passed()) diff --git a/src/game/World.h b/src/game/World.h index 2d42f8f..61ab772 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -51,7 +51,8 @@ enum ServerMessageType SERVER_MSG_RESTART_TIME = 2, SERVER_MSG_STRING = 3, SERVER_MSG_SHUTDOWN_CANCELLED = 4, - SERVER_MSG_RESTART_CANCELLED = 5 + SERVER_MSG_RESTART_CANCELLED = 5, + SERVER_MSG_CUSTOM = 6 }; enum ShutdownMask @@ -81,7 +82,9 @@ enum WorldTimers WUPDATE_AUTOBROADCAST = 8, WUPDATE_EXT_MAIL = 9, WUPDATE_AHBOT = 10, - WUPDATE_COUNT = 11 + WUPDATE_RP_LUPT = 11, // WLK RP LUPT v0.3M + WUPDATE_COUNT = 12 + }; /// Configuration elements @@ -194,7 +197,10 @@ enum eConfigUInt32Values CONFIG_UINT32_BASE_PET_SCALE, // External Mail CONFIG_UINT32_EXTERNAL_MAIL_INTERVAL, - CONFIG_UINT32_VALUE_COUNT + CONFIG_UINT32_RP_LUPT_CHECK_INTERVAL, // WLK RP LUPT v0.3M + CONFIG_UINT32_RP_LUPT_AGE_FOR_LEVEL, // WLK RP LUPT v0.3M + CONFIG_UINT32_RP_LUPT_MSG_TYPE, // WLK RP LUPT v0.3M + CONFIG_UINT32_VALUE_COUNT }; /// Configuration elements @@ -353,7 +359,9 @@ enum eConfigBoolValues CONFIG_BOOL_ENABLE_DODGE_CAP, /// Darkrulerz' Customs - CONFIG_BOOL_VALUE_COUNT + CONFIG_BOOL_RP_LUPT, // WLK RP LUPT v0.3M + CONFIG_BOOL_RP_LUPT_MSG_ENABLED, // WLK RP LUPT v0.3M + CONFIG_BOOL_VALUE_COUNT }; /// Can be used in SMSG_AUTH_RESPONSE packet @@ -501,6 +509,31 @@ class World /// Get the current Message of the Day const char* GetMotd() const { return m_motd.c_str(); } + /// WLK RP LUPT system v0.3M - Sets a name of the message table + void World::SetRpLuptTableName(const std::string& rpluptTable); + /// WLK RP LUPT system v0.3M - Returns a name of the message table + const char* World::GetRpLuptTableName() const; + + // WLK RP LUPT system v0.3M - Loads system messages + void LoadLuptMessages(); + struct LuptMessagesData + { + uint8 msgType; + std::string msgText; + }; + typedef UNORDERED_MAP<uint32, LuptMessagesData> LuptMessagesDataMap; + private: + std::string m_rpluptTable; + LuptMessagesDataMap mLuptMessagesData; + public: + LuptMessagesData const* GetLuptMessagesData( uint32 bytes ) const + { + LuptMessagesDataMap::const_iterator itr = mLuptMessagesData.find( bytes ); + if( itr != mLuptMessagesData.end() ) + return &itr->second; + return NULL; + } // WLK end + LocaleConstant GetDefaultDbcLocale() const { return m_defaultDbcLocale; } /// Get the path where data (dbc, maps) are stored on disk
-
I want to know how i can make a check if players are multiboxing i need this to prevent a reward-system in my custom script. thx in advance
Contact Us
To contact us
click here
You can also email us at [email protected]
Privacy Policy | Terms & Conditions
You can also email us at [email protected]
Privacy Policy | Terms & Conditions
Copyright © getMaNGOS. All rights Reserved.
This website is in no way associated with or endorsed by Blizzard Entertainment®
This website is in no way associated with or endorsed by Blizzard Entertainment®