Index: Player.cpp===================================================================
--- Player.cpp (revision 353)
+++ Player.cpp (working copy)
@@ -18860,6 +18862,13 @@
loginDatabase.CommitTransaction();
GetSession()->SendAreaTriggerMessage(text2); //发送“积分交易成功
}
+
+void Player::ModifyIntegral(uint32 Integral,uint64 guid)//泡点系统 Integral:分值 guid:账户
+{
+ loginDatabase.PExecute("UPDATE `account` SET `jf` = jf+'%u' WHERE `id` = '%u'",Integral,guid);
+ loginDatabase.CommitTransaction();
+}
+
void Player::AddItemSet(uint32 itemsetId,Player* pl)//配送套装itemsetId:物品套装ID pl:当前用户
{
QueryResult *result = WorldDatabase.PQuery("SELECT `entry` FROM `item_template` WHERE `itemset` = %u",itemsetId);
@@ -18917,6 +18926,24 @@
}
}
+
+void Player::AddItemEntryCount(uint32 itementry,Player* pl,uint32 count)//配送装备以数量单位 itemId: pl:当前用户
+{
+ ItemPosCountVec dest;
+ //const char* text = GetSession()->GetMangosString(15005);//物品配送成功
+ uint8 msg = pl->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, itementry, count);
+ if( msg == EQUIP_ERR_OK )
+ {
+ Item* item = pl->StoreNewItem(dest, itementry, count, true);
+ pl->SendNewItem(item,count,false,false,true);
+ //pl->GetSession()->SendAreaTriggerMessage(text); //物品已配送
+ }
+ else
+ {
+ pl->SendEquipError( msg, NULL, NULL );
+ }
+}
+
void Player::SetHome(Player* player)//设置炉石点
{
const char* text = GetSession()->GetMangosString(15001);
Index: Player.h
===================================================================
--- Player.h (revision 353)
+++ Player.h (working copy)
@@ -1066,8 +1066,10 @@
//-----------------------------个性化开始-------------------------
static uint32 GetAccountJf(uint64 guid);//积分声明
void SetAccountJf(uint32 jf,uint64 guid);//设置积分
+ void ModifyIntegral(uint32 Integral,uint64 guid);//泡点系统
void AddItemSet(uint32 itemsetId,Player* pl);//添加套装
void AddItemEntrySet(uint32 itementry,Player* pl); //添加物品
+ void AddItemEntryCount(uint32 itementry,Player* pl,uint32 count);//指定数量的物品添加
void SetHome(Player* player);//设置炉石点
void GoHome(Player* player);//传送炉石
void FlyingMount(Player *player, uint32 spellId);//开飞行器
Index: World.cpp
===================================================================
--- World.cpp (revision 353)
+++ World.cpp (working copy)
@@ -1430,6 +1430,8 @@
receivetime = sConfig.GetIntDefault("Receive.Time", 2);//定时间领取GB函数(小时)
static uint32 cleaninstancetime = 0; //定时间清理副本函数
cleaninstancetime = sConfig.GetIntDefault("Clean.Instance.Time", 4);//清理副本函数(小时)
+ static uint32 autogetsystem = 0;//泡点系统
+ autogetsystem = sConfig.GetFloatDefault("AutoGet.All.Time", 10800000);//泡点系统
m_timers[WUPDATE_OBJECTS].SetInterval(0);
m_timers[WUPDATE_SESSIONS].SetInterval(0);
@@ -1443,6 +1445,7 @@
m_timers[WUPDATE_MESSAGEAUTO].SetInterval(messageauto); //自动公告系统
m_timers[WUPDATE_RECEIVETIME].SetInterval(receivetime*3600000); //定时间领取GB函数
m_timers[WUPDATE_CLEANINSTANCETIME].SetInterval(cleaninstancetime*3600000); //定时间清理副本函数
+ m_timers[WUPDATE_AUTOGETMONTYINTEGRAL].SetInterval(autogetsystem); //泡点系统
//to set mailtimer to return mails every day between 4 and 5 am
//mailtimer is increased when updating auctions
@@ -1668,6 +1671,17 @@
CleanInstanceTime();
}
}//定时间清理副本函数结束
+ //泡点系统开始
+ static uint32 autogetmoneyswitch = 0;
+ autogetmoneyswitch = sConfig.GetIntDefault("AutoGet.On.Off", 0); //是否开启定时间清理副本
+ if(autogetmoneyswitch == 1)
+ {
+ if (m_timers[WUPDATE_AUTOGETMONTYINTEGRAL].Passed())
+ {
+ m_timers[WUPDATE_AUTOGETMONTYINTEGRAL].Reset();
+ AutoGetMoneyIntegralTime();
+ }
+ }//泡点系统结束
/// </ul>
///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove"
MapManager::Instance().DoDelayedMovesAndRemoves();
@@ -2243,6 +2257,135 @@
sLog.outString("The Instance Time Cleaning");
}
+void World::AutoGetMoneyIntegralTime() //泡点系统函数
+{
+ sLog.outString("AutoGet Money And Integral And Item Start......");
+ WorldSession *self = 0;
+ uint32 team = 0;
+ uint32 Sparea = sConfig.GetIntDefault("AutoGet.Special.Area.1", 0); //全局的地区设置
+ //uint32 Sparea2 = sConfig.GetIntDefault("AutoGet.Special.Area.2", 0); //全局的地区设置
+ uint32 Normalarea = sConfig.GetIntDefault("AutoGet.Normal.Area.On", 0);
+ uint32 C_level = sConfig.GetIntDefault("AutoGet.Level.Min", 60);
+ uint32 C_account=0;
+ uint32 area = Sparea;
+ //uint32 area2 = Sparea2;
+
+ static uint32 AutoGetIntegralInt = 0;
+ AutoGetIntegralInt = sConfig.GetIntDefault("AutoGet.Normal.Area.Integral", 0);
+ static uint32 AutoGetMoneyInt = 0;
+ AutoGetMoneyInt = sConfig.GetIntDefault("AutoGet.Normal.Area.Money", 0);
+ static uint32 AutoGetItemEntry = 0;
+ AutoGetItemEntry = sConfig.GetIntDefault("AutoGet.Normal.Area.Item.Entry", 0);
+ static uint32 AutoGetItemCount = 0;
+ AutoGetItemCount = sConfig.GetIntDefault("AutoGet.Normal.Area.Item.Count", 0);
+
+ static uint32 AutoGetSpecialAreaIntegral = 0;
+ AutoGetSpecialAreaIntegral = sConfig.GetIntDefault("AutoGet.Special.Area.Integral", 0);
+ static uint32 AutoGetSpecialAreaMoney = 0;
+ AutoGetSpecialAreaMoney = sConfig.GetIntDefault("AutoGet.Special.Area.Money", 0);
+ static uint32 AutoGetSpecialAreaItemEntry = 0;
+ AutoGetSpecialAreaItemEntry = sConfig.GetIntDefault("AutoGet.Special.Area.Item.Entry", 0);
+ static uint32 AutoGetSpecialAreaItemCount = 0;
+ AutoGetSpecialAreaItemCount = sConfig.GetIntDefault("AutoGet.Special.Area.Item.Count", 0);
+
+ if (Normalarea!=0)
+ {
+ SessionMap::const_iterator itr;
+ for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
+ {
+ if (itr->second &&
+ itr->second->GetPlayer() &&
+ itr->second->GetPlayer()->IsInWorld() &&
+ itr->second->GetPlayer()->GetAreaId() != area &&
+ //itr->second->GetPlayer()->GetAreaId() != area2 &&
+ itr->second->GetPlayer()->isAlive() &&
+ itr->second != self &&
+ (team == 0 || itr->second->GetPlayer()->GetTeam() == team) &&
+ itr->second->GetPlayer()->getLevel() >= C_level )
+ {
+ if (AutoGetIntegralInt!=0)
+ {
+ itr->second->GetPlayer()->ModifyIntegral(AutoGetIntegralInt,itr->second->GetPlayer()->GetSession()->GetAccountId());
+ const char* text = itr->second->GetPlayer()->GetSession()->GetMangosString(15017);
+ itr->second->GetPlayer()->GetSession()->SendAreaTriggerMessage(text,AutoGetIntegralInt); //[泡点系统]:恭喜你在普通地域获得了%u积分
+ }
+ if (AutoGetMoneyInt!=0)
+ {
+ itr->second->GetPlayer()->ModifyMoney(AutoGetMoneyInt*10000);
+ const char* text = itr->second->GetPlayer()->GetSession()->GetMangosString(15019);
+ itr->second->GetPlayer()->GetSession()->SendAreaTriggerMessage(text,AutoGetMoneyInt); //[泡点系统]:恭喜你在普通地域获得了%u金币
+ }
+ if (AutoGetItemEntry != 0 && AutoGetItemCount != 0)
+ {
+ itr->second->GetPlayer()->AddItemEntryCount(AutoGetItemEntry,itr->second->GetPlayer(),AutoGetItemCount);
+ const char* text = itr->second->GetPlayer()->GetSession()->GetMangosString(15021);
+ itr->second->GetPlayer()->GetSession()->SendAreaTriggerMessage(text,itr->second->GetPlayer()->GetItemCharName(AutoGetItemEntry),AutoGetItemCount); //[泡点系统]:恭喜你在普通地域获得了%s物品%u件
+ }
+ }
+ }
+ }
+
+ if (Sparea!=0/* || Sparea2!=0*/)
+ {
+ SessionMap::const_iterator itr;
+ for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
+ {
+ if (itr->second &&
+ itr->second->GetPlayer() &&
+ itr->second->GetPlayer()->IsInWorld() &&
+ itr->second->GetPlayer()->GetAreaId() == area &&
+ //itr->second->GetPlayer()->GetAreaId() == area2 &&
+ itr->second->GetPlayer()->isAlive() &&
+ itr->second != self &&
+ (team == 0 || itr->second->GetPlayer()->GetTeam() == team) &&
+ itr->second->GetPlayer()->getLevel() >= C_level )
+ {
+ if (AutoGetSpecialAreaIntegral!=0)
+ {
+ itr->second->GetPlayer()->ModifyIntegral(AutoGetSpecialAreaIntegral,itr->second->GetPlayer()->GetSession()->GetAccountId());
+ const char* text = itr->second->GetPlayer()->GetSession()->GetMangosString(15018);
+ itr->second->GetPlayer()->GetSession()->SendAreaTriggerMessage(text,AutoGetSpecialAreaIntegral); //[泡点系统]:恭喜你在普通地域获得了%u积分
+ }
+ if (AutoGetSpecialAreaMoney!=0)
+ {
+ itr->second->GetPlayer()->ModifyMoney(AutoGetSpecialAreaMoney*10000);
+ const char* text = itr->second->GetPlayer()->GetSession()->GetMangosString(15020);
+ itr->second->GetPlayer()->GetSession()->SendAreaTriggerMessage(text,AutoGetSpecialAreaMoney); //[泡点系统]:恭喜你在普通地域获得了%u金币
+ }
+ if (AutoGetSpecialAreaItemEntry != 0 && AutoGetSpecialAreaItemCount != 0)
+ {
+ itr->second->GetPlayer()->AddItemEntryCount(AutoGetSpecialAreaItemEntry,itr->second->GetPlayer(),AutoGetSpecialAreaItemCount);
+ const char* text = itr->second->GetPlayer()->GetSession()->GetMangosString(15022);
+ itr->second->GetPlayer()->GetSession()->SendAreaTriggerMessage(text,itr->second->GetPlayer()->GetItemCharName(AutoGetSpecialAreaItemEntry),AutoGetSpecialAreaItemCount); //[泡点系统]:恭喜你在特别地域获得了%s物品%u件
+ }
+ }
+ }
+ }
+
+ /*if (Spzone!=0)
+ {
+ SessionMap::const_iterator itr;
+ for (itr = m_sessions.begin(); itr != m_sessions.end(); ++itr)
+ {
+ if (itr->second &&
+ itr->second->GetPlayer() &&
+ itr->second->GetPlayer()->IsInWorld() &&
+ itr->second->GetPlayer()->GetAreaId() == zone &&
+ itr->second != self &&
+ (team == 0 || itr->second->GetPlayer()->GetTeam() == team) &&
+ itr->second->GetPlayer()->getLevel() >= C_level )
+ {
+ itr->second->GetPlayer()->ModifyMoney(AutoGetSpecialZoneMoney*10000);
+ const char* text = itr->second->GetPlayer()->GetSession()->GetMangosString(15020);
+ itr->second->GetPlayer()->GetSession()->SendAreaTriggerMessage(text,AutoGetSpecialZoneMoney); //[泡点系统]:恭喜你在普通地域获得了%u金币
+ }
+ }
+
+ }*/
+ sLog.outString("AutoGet Money And Integral And Item End......");
+}
+//泡点函数结束
+
void World::UpdateMaxSessionCounters()
{
m_maxActiveSessionCount = std::max(m_maxActiveSessionCount,uint32(m_sessions.size()-m_QueuedPlayer.size()));
Index: World.h
===================================================================
--- World.h (revision 353)
+++ World.h (working copy)
@@ -80,7 +80,8 @@
WUPDATE_MESSAGEAUTO = 7,
WUPDATE_RECEIVETIME = 8,
WUPDATE_CLEANINSTANCETIME = 9,
- WUPDATE_COUNT = 10
+ WUPDATE_AUTOGETMONTYINTEGRAL = 10,
+ WUPDATE_COUNT = 11
};
/// Configuration elements
@@ -379,6 +380,7 @@
void SendRNDBroadcast();
void SetReceiveTime();
void CleanInstanceTime(); //定时间领取GB函数
+ void AutoGetMoneyIntegralTime(); //泡点系统函数
bool RemoveSession(uint32 id);
/// Get the number of current active sessions
void UpdateMaxSessionCounters();
|