/******************************************************************
** 文件名: BagSystem.cpp
** 版 权: (C) 深圳网域计算机网络有限公司
** 创建人:
** 日 期:
** 版 本: 1.0
** 描 述:
** 应 用:
**************************** 修改记录 ******************************
** 修改人: Anonymous
** 日 期: 2009.2.18
** 描 述: 整理背包子系统代码
** 基本原则:
********************************************************************/
#include "stdafx.h"
#include "BagSystem.h"
#include "share\item\SortItem.h"
#include "warehouseDef.h"
#include "MagicItemSystem/IMagicItemSystem.h"
#include "Share/WarehouseExpendTable/IWarehouseExpendTable.h"
#include "db/WorldServer/DB_ActorLogin.h"
#include "GameEngine/IEntityBehaviorFSM.h"
#include "Entity/EquipSystemDef.h"
#include "IEntityBroadcastSystem.h"
#include "Pet\IPetCardTrans.h"
#include "Share\GlobalCfg\IGlobalCfg.h"
#include "NPCInteractive\IInteractSystem.h"
#include "NpcInteractDef.h"
#include "Entity/EntityErrorDef.h"
#include "property\EquipUpLevelProperty.h"
#include "ItemEquipSystem\IEquipUpLevelTable.h"
//////////////////////////////////////////////////////////////////////////
// global export function define
extern "C" __declspec(dllexport) IObject * createBagSystemFunc()
{
return new BagSystem();
}
//////////////////////////////////////////////////////////////////////////
// class member function define
BagSystem::BagSystem() : m_bActived(true),
m_bCreating(false),
m_bCreateSuccess(false),
m_hEntity(0),
m_dropMoneyCount(0),
m_moneyInStorage(0),
m_bagSlotCnt(0),
m_pitemInfo(0),
m_pitemLen(0),
m_pstorageItemInfo(0),
m_pstorageItemLen(0),
m_transBuf(0),
m_transBufLen(0),
m_bagSortCDObj(0),
m_stoageSortCDObj(0)
{
initMessageHandler();
}
BagSystem::~BagSystem()
{
// clear resource
clearBagRes();
clearStorageRes();
// delete buffering data
ITEM_SAFE_FREE(m_pitemInfo);
ITEM_SAFE_FREE(m_pstorageItemInfo);
ITEM_SAFE_FREE(m_transBuf);
unRegEquipSysMsgBroadCast();
}
HEntity BagSystem::getHandle()const
{
return m_hEntity;
}
Int32 BagSystem::getID()const
{
return IID_IBagSystem;
}
void BagSystem::registerMessageHandler(Uint32 msgId, MSG_HANDLER handler)
{
MSG_HANDLER_LIST::const_iterator iterEnd = m_mapMsgHandler.end();
if (iterEnd == m_mapMsgHandler.find(msgId))
{
m_mapMsgHandler[msgId] = handler;
}
}
void BagSystem::initMessageHandler()
{
registerMessageHandler(MSG_CG_ITEM_EQUIP_BAG, &BagSystem::onRecvEquipBag);
registerMessageHandler(MSG_CG_ITEM_REMOVE_BAG, &BagSystem::onRecvRemoveBag);
registerMessageHandler(MSG_CG_ITEM_MOVE_ITEM, &BagSystem::onRecvMoveItem);
registerMessageHandler(MSG_CG_ITEM_SPLIT_ITEM, &BagSystem::onRecvSplitEquip);
registerMessageHandler(MSG_CG_ITEM_DISCARD_ITEM, &BagSystem::onRecvDiscardItem);
registerMessageHandler(MSG_CG_ITEM_USE_ITEM, &BagSystem::onRecvUseItem);
registerMessageHandler(MSG_CG_ITEM_BOX_GET_ITEM, &BagSystem::onRecvBoxGetItem);
registerMessageHandler(MSG_CG_ITEM_BOX_OPEN, &BagSystem::onRecvBoxOpen);
registerMessageHandler(MSG_CG_ITEM_ADD_MEND, &BagSystem::onRecvAddMend);
registerMessageHandler(MSG_CG_ITEM_REMOVE_MEND, &BagSystem::onRecvRemoveMend);
registerMessageHandler(MSG_CG_ITEM_ADD_GEM, &BagSystem::onRecvAddGem);
registerMessageHandler(MSG_CG_ITEM_ADD_GEM_BATCH, &BagSystem::onRecvAddGemBatch);
registerMessageHandler(MSG_CG_ITEM_ADD_CHARM, &BagSystem::onRecvAddCharm);
registerMessageHandler(MSG_CG_ITEM_DECOMPOSE, &BagSystem::onRecvDecompose);
registerMessageHandler(MSG_CG_ITEM_LOCK, &BagSystem::onRecvLock);
registerMessageHandler(MSG_CG_ITEM_GEMBOX_CLOSED, &BagSystem::onRecvClientGemBoxUIClosed);
registerMessageHandler(MSG_CG_SORT_BAG, &BagSystem::onRecvSortBag);
registerMessageHandler(MSG_CG_SORT_BAG_FINISHED, &BagSystem::onRecvSortBagFinished);
registerMessageHandler(MSG_CG_ITEM_PUT_ITEM_TO_BAG, &BagSystem::onRecvPutItemToBag);
registerMessageHandler(MSG_CG_ITEM_PREPARE_TO_SORT, &BagSystem::onRecvPrepareToSortBag);
registerMessageHandler(MSG_CG_ITEM_UPLEVEL_EQUIP, &BagSystem::onRecvUpLevelEquip);
registerMessageHandler(MSG_CG_ITEM_EQUIP_INHERIT, &BagSystem::onRecvEquipInherit);
registerMessageHandler(MSG_CG_ITEM_COMPOSE, &BagSystem::onRecvItemCompose);
registerMessageHandler(MSG_CG_STORAGE_EQUIPBAG, &BagSystem::Storage_onRecvEquipBag);
registerMessageHandler(MSG_CG_STORAGE_MOVEITEM, &BagSystem::Storage_onRecvMoveItem);
registerMessageHandler(MSG_CG_STORAGE_PUT_MONEY, &BagSystem::Storage_onRecvPutMoney);
registerMessageHandler(MSG_CG_STORAGE_REMOVEBAG, &BagSystem::Storage_onRecvRemoveBag);
registerMessageHandler(MSG_CG_STORAGE_BUY_BAGSLOT, &BagSystem::Storage_onRecvBuyBagSlot);
registerMessageHandler(MSG_CG_STORAGE_MOVESTORAGEITEM, &BagSystem::Storage_onRecvMoveStorageItem);
registerMessageHandler(MSG_CG_STORAGE_EQUIPBAGFROMBAG, &BagSystem::Storage_onRecvEquipBagFromBag);
registerMessageHandler(MSG_CG_STORAGE_GET_BAGSLOT_EXPEND, &BagSystem::Storage_onRecvGetBuyBagSlotExpend);
registerMessageHandler(MSG_CG_STORAGE_DISCARD_ITEM, &BagSystem::Storage_onRecvDiscardItem);
registerMessageHandler(MSG_CG_STORAGE_SPLIT_ITEM, &BagSystem::Storage_onRecvSplitItem);
registerMessageHandler(MSG_CG_STORAGE_UNEQUIP_BAG_TO_BAGSYSTEM, &BagSystem::Storage_onRecvUnEquipBagToBagSystem);
registerMessageHandler(MSG_CG_STORAGE_SORT_BAG, &BagSystem::Storage_onRecvSortBag);
registerMessageHandler(MSG_CG_STORAGE_SORT_BAG_FINISHED, &BagSystem::onRecvSortStorageBagFinished);
registerMessageHandler(MSG_CG_STORAGE_PUT_ITEM_TO_BAG, &BagSystem::Storage_onRecvPutItemToBag);
registerMessageHandler(MSG_CG_STORAGE_PREPARE_TO_SORT, &BagSystem::Storage_onRecvPrepareToSortBag);
}
Int32 BagSystem::onRecv(ListenerHandle handle, Uint32 wParam, Uint32 lParam)
{
ibuffer in((void*)wParam,lParam);
Uint8 msg;
in >> msg;
Uint32 nLen = (Uint32)(in.size()-in.pos());
FCL_PROMON_ENTITYCMD("BagSystem", msg);
MSG_HANDLER_LIST::const_iterator iter = m_mapMsgHandler.find(msg);
if (iter != m_mapMsgHandler.end())
{
(this->*(iter->second))(in.current(), nLen);
}
return handle(wParam, lParam);
}
Int32 BagSystem::onEntityDead(ListenerHandle hf, Uint32 wParam, Uint32 lParam)
{
// 处理物品死亡消失
for (Uint32 bagid = 0; bagid < BAGS_BAG_MAX; ++bagid)
{
IPackage *pkg = getPackage(bagid);
if (pkg)
{
for(Uint32 slot = 0; slot < pkg->size(); ++slot)
{
IItem* pItem = getItemFromHandle(pkg->getItem(slot));
if (pItem)
{
if (ITEM_DROPOUT_DEAD == pItem->getProperty(PROP_WITHDEAD, Int32(0)))
{
destoryItem(bagid, slot);
}
}
}
}
}
return hf(wParam,lParam);
}
void BagSystem::preRelease()
{
unRegisterSubSysEvent();
unRegisterSubSysMessage();
IEntity* pEntity = getEntityFromHandle(m_hEntity);
if (pEntity)
{
ICoolDownSystem* cdSystem = (ICoolDownSystem*)pEntity->queryEntitySystem(IID_CoolDownSystem);
if (!cdSystem)
{
ITEM_ERROR(_FMT("%s 找不到实体的冷却子系统\n", __FUNCTION__));
return ;
}
ICoolDownObject **cdObjArray[2] = {
&m_bagSortCDObj,
&m_stoageSortCDObj
};
for (Int32 i = 0; i < 2; i++)
{
ICoolDownObject *pObj = *cdObjArray[i];
if (pObj)
{
ITEM_INFO(_FMT("%s 删除背包整理冷却[index=%d]对象\n", __FUNCTION__, i));
cdSystem->releaseCDObject(pObj);
pObj = 0;
}
}
}
}
void BagSystem::clearBagRes()
{
MapPackages::iterator iter;
MapPackages::iterator iterEnd = m_mapPackages.end();
for (iter = m_mapPackages.begin(); iter != iterEnd; ++iter)
{
Int32 bagId = iter->first;
IPackage *pPackage = iter->second;
if (pPackage)
{
for (Uint32 i = 0; i < pPackage->size(); ++i)
{
HItem hItem = pPackage->getItem(i);
IItem* pItem = getItemFromHandle(hItem);
if (pItem)
没有合适的资源?快使用搜索试试~ 我知道了~
网页游戏烈火战神GAMESERVER源代码
共1952个文件
h:1241个
cpp:605个
vcproj:52个
1星 需积分: 48 55 下载量 21 浏览量
2013-07-29
09:52:59
上传
评论 12
收藏 2.91MB RAR 举报
温馨提示
网页游戏烈火战神GAMESERVER游戏主程序源代码 开发环境C++ 7.10 其他不多说。
资源推荐
资源详情
资源评论
收起资源包目录
网页游戏烈火战神GAMESERVER源代码 (1952个子文件)
BagSystem.cpp 388KB
EquipSystem.cpp 216KB
SkillFactory.cpp 171KB
MagicItemSystem.cpp 139KB
SkillSystem.cpp 119KB
OrderForm.cpp 111KB
Pet.cpp 110KB
LootSystem.cpp 109KB
Entity.cpp 105KB
BuffFactory.cpp 81KB
Battle.cpp 76KB
EntityPropPacker.cpp 73KB
Pksystem.cpp 72KB
Item.cpp 71KB
EventCollect.cpp 71KB
mailsystem.cpp 69KB
ShopSystem.cpp 66KB
EffectFactory.cpp 65KB
PetEquipSystem.cpp 65KB
HitResultCalculator.cpp 62KB
BuffSystem.cpp 60KB
Skill.cpp 60KB
ActorPropCalcSystem.cpp 59KB
HelpSystem.cpp 56KB
EntityFactory.cpp 55KB
PetSystem.cpp 54KB
TransToolSystem.cpp 52KB
LogicItem.cpp 47KB
EntityLifeFSM.cpp 47KB
EntityBuff.cpp 47KB
ItemSwapper.cpp 47KB
EntityObserver.cpp 45KB
QuestSystem.cpp 44KB
GameAIProxy.cpp 43KB
EntityBroadcastSystem.cpp 41KB
BattleStat.cpp 41KB
EntitySwapper.cpp 40KB
Vest.cpp 40KB
MountManage.cpp 39KB
GameFunctionArea.cpp 38KB
AIPipe.cpp 37KB
FortBattleWrapper.cpp 36KB
DataStatistic.cpp 35KB
QuestSwapper.cpp 34KB
GuildSystem.cpp 34KB
PetFactory.cpp 33KB
ctocTradeMgr.cpp 33KB
TransSystem.cpp 32KB
NpcInteractiveSwapper.cpp 31KB
GridWorld.cpp 31KB
GameScene.cpp 30KB
PetCardTrans.cpp 30KB
NormalFormulaSkill.cpp 30KB
ExploreSystem.cpp 30KB
BattleMem.cpp 28KB
newTradeSession.cpp 28KB
SkillEffect_BuffEnPhyDamage.cpp 26KB
NpcBooty.cpp 26KB
BattleCondSteleResAndObtainRes.cpp 26KB
LogicItemFactory.cpp 26KB
Stele_UseLogicItem.cpp 25KB
FameSystem.cpp 25KB
BattleRegister.cpp 24KB
WorldSceneBattleRegister_GuildScore.cpp 24KB
EntityObserverProp.cpp 24KB
ResourceGenerator.cpp 24KB
LogicItemObserverSystem.cpp 23KB
EntityDBSystem.cpp 23KB
EffectSystem.cpp 22KB
MountSystem.cpp 22KB
BattleCondSteleRes.cpp 21KB
titleSystem.cpp 21KB
PetObserverSystem.cpp 20KB
SkillEffect_TwoHandsDamage.cpp 19KB
SkillEffect_PutOutDamage.cpp 19KB
ItemUseFactory.cpp 19KB
GameWorld.cpp 19KB
PkObserver.cpp 19KB
newTradeComponent.cpp 19KB
DamageCalculator.cpp 19KB
LogoutMgr.cpp 18KB
BuffDamageCalculator.cpp 18KB
corpseLootSystem.cpp 18KB
EntityExpTable.cpp 18KB
EntityPostureFSM.cpp 18KB
PetSwapper.cpp 18KB
GmPipe.cpp 18KB
EntityHomePointSystem.cpp 17KB
EntityCreateQueue.cpp 17KB
ActorPropPointAdjustSystem.cpp 17KB
MonsterFactory.cpp 17KB
NewTitleSystem.cpp 17KB
BattleAward.cpp 16KB
PetPipe.cpp 16KB
InteractivePage.cpp 16KB
BattleReliveMgr.cpp 16KB
StoreSystem.cpp 16KB
Stele_HitAndUseItem.cpp 16KB
ComposeModule.cpp 16KB
BattleScriptCfg.cpp 16KB
共 1952 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
- xuziqiang2014-05-21垃圾,这不是烈火战神GAMESERVER的源代码..
- hongfengxb2014-06-09下载了貌似不是源码
wqc159
- 粉丝: 21
- 资源: 122
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功