//从dbserver接收到的道具信息 public void AddItemInfo(GameBase.Network.Internal.RoleData_Item item) { GameStruct.RoleItemInfo info = new GameStruct.RoleItemInfo(); info.id = item.id; info.itemid = item.itemid; info.postion = item.postion; info.stronglv = item.stronglv; info.gem1 = item.gem1; info.gem2 = item.gem2; info.forgename = item.forgename; info.amount = item.amount; info.war_ghost_exp = item.war_ghost_exp; info.di_attack = item.di_attack; info.shui_attack = item.shui_attack; info.huo_attack = item.huo_attack; info.feng_attack = item.feng_attack; info.property = item.property; info.gem3 = item.gem3; info.god_exp = item.god_exp; info.god_strong = item.god_strong; mDicItem[info.id] = info; if (info.postion == NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK) { info.typeid = IDManager.CreateTypeId(OBJECTTYPE.EUDEMON); } //if (info.postion == NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK) //{ // mBagCount++; //} CalcEquipLook(); }
private uint nOwnerid; //道具爆出的所有者- #endregion Fields #region Constructors //存活时间) public DropItemObject(uint itemid/*基本物品数据库的id*/,short x,short y,uint ownerid,int time) { mTime = time; type = OBJECTTYPE.DROPITEM; typeid = itemid; mCurTime = System.Environment.TickCount; nOwnerid = ownerid; SetPoint(x, y); mItemInfo = null; }
public DropItemObject(uint itemid /*基本物品数据库的id*/, short x, short y, uint ownerid, int time)//存活时间) { mTime = time; type = OBJECTTYPE.DROPITEM; typeid = itemid; mCurTime = System.Environment.TickCount; nOwnerid = ownerid; SetPoint(x, y); mItemInfo = null; }
public void SetRoleItemInfo(GameStruct.RoleItemInfo info) { mItemInfo = info; }
//这个函数用于玩家丢弃的道具,然后又捡起来应用..所以不叠加 public GameStruct.RoleItemInfo AwardItem(GameStruct.RoleItemInfo info) { if (IsGold(info.itemid)) { play.ChangeAttribute(GameStruct.UserAttribute.GOLD, info.property); play.LeftNotice(string.Format("获得{0}金币!", info.property)); return null; } GameStruct.ItemTypeInfo baseitem = ConfigManager.Instance().GetItemTypeInfo(info.itemid); if (baseitem == null) { Log.Instance().WriteLog("创建道具失败,道具不存在 id:" + info.itemid.ToString()); // return null; if (!GameServer.IsTestMode()) return null; baseitem = new GameStruct.ItemTypeInfo(); baseitem.id = info.itemid; } uint key = (uint)mDicAddItem.Count + 1; GameStruct.RoleItemInfo item = new GameStruct.RoleItemInfo(); item.itemid = baseitem.id; item.postion = info.postion; item.stronglv = info.stronglv; item.gemcount = info.gemcount; item.amount = info.amount; item.gem1= info.gem1; item.gem2 = info.gem2; item.forgename = info.forgename; item.war_ghost_exp = info.war_ghost_exp; item.di_attack = info.di_attack; item.huo_attack = info.huo_attack; item.shui_attack = info.shui_attack; item.feng_attack = info.feng_attack; item.property = info.property; item.gem3 = info.gem3; item.god_strong = info.god_strong; item.god_exp = info.god_exp; item.typeid = info.typeid; mDicAddItem[key] = item; //发给dbserver 通知增加这个道具 GameBase.Network.Internal.AddRoleData_Item dbitem = new GameBase.Network.Internal.AddRoleData_Item(); dbitem.item.playerid = play.GetBaseAttr().player_id; dbitem.gameid = play.GetGameID(); dbitem.item.postion = item.postion; dbitem.item.itemid = item.itemid; dbitem.item.stronglv = item.stronglv; dbitem.item.amount = item.amount; dbitem.item.gem1 = item.gem1; dbitem.item.gem2 = item.gem2; dbitem.item.forgename = item.forgename; dbitem.item.war_ghost_exp = item.war_ghost_exp; dbitem.item.di_attack = item.di_attack; dbitem.item.huo_attack = item.huo_attack; dbitem.item.shui_attack = item.shui_attack; dbitem.item.feng_attack = item.feng_attack; dbitem.item.property = item.property; dbitem.item.gem3 = item.gem3; dbitem.item.god_strong = item.god_strong; dbitem.item.god_exp = item.god_exp; dbitem.sortid = key; DBServer.Instance().GetDBClient().SendData(dbitem.GetBuffer()); return item; }
//丢弃金钱 //gold 金钱数量 public void DropGold(int gold) { play.ChangeAttribute(GameStruct.UserAttribute.GOLD, -gold); play.LeftNotice(string.Format("您遗失了{0}金币!", gold)); GameStruct.RoleItemInfo info = new GameStruct.RoleItemInfo(); info.property = gold; short x = 0; short y = 0; if (!this.GetDropItemPoint(ref x, ref y)) return; if (gold < 10) { info.itemid = GameBase.Config.Define.GOLD_ITEM_1; //几个金币 } else if (gold > 10 && gold < 100) { info.itemid = GameBase.Config.Define.GOLD_ITEM_2; //一些金币 } else if (gold > 100 && gold < 500) { info.itemid = GameBase.Config.Define.GOLD_ITEM_3; //许多金币 } else if (gold > 500 && gold < 1500) { info.itemid = GameBase.Config.Define.GOLD_ITEM_4; //一小堆金币 } else info.itemid = GameBase.Config.Define.GOLD_ITEM_5; //一大堆金币 this.play.GetGameMap().AddDropItemObj(info.itemid, x, y, 0, 120000,info); }
//public RoleData_Eudemon AwardEudemon(uint itemid) //{ //} //创建物品参数说明 //postion:道具位置 //amount:数量 //stronglv: 强化等级 //gem1: 第一洞宝石 255为打孔 //gem2: 第二洞镶嵌的宝石 255为打孔 //gem3: 第三洞镶嵌的宝石 255为打孔 //warghost_exp: 战魂等级 最高9级 //di_attack : 地攻击 最高255级 //shui_attack: 水攻击 最高255级 //huo_attack: 火攻击 最高255级 //feng_attack: 风攻击 最高255级 //limit: 是否叠加 public GameStruct.RoleItemInfo AwardItem(uint itemid, byte postion, byte amount = 1, byte stronglv = 0,byte gem1 = 0,byte gem2 = 0,byte gem3 = 0,byte warghost_exp = 0, byte di_attack = 0,byte shui_attack = 0,byte huo_attack = 0,byte feng_attack = 0,bool limit = true/*是否叠加*/) { //是金币 if (IsGold(itemid)) { return null; } GameStruct.ItemTypeInfo baseitem = ConfigManager.Instance().GetItemTypeInfo(itemid); if (baseitem == null) { Log.Instance().WriteLog("创建道具失败,道具不存在 id:" + itemid.ToString()); // return null; if (!GameServer.IsTestMode()) return null; baseitem = new GameStruct.ItemTypeInfo(); baseitem.id = itemid; } GameStruct.RoleItemInfo item = null; //可叠加 if (!IsEquip(baseitem.id) && limit && baseitem.amount_limit > 1) { item = ItemLimit(itemid, (byte)baseitem.amount); if(item != null) { return item; } } uint key = (uint)mDicAddItem.Count + 1; item = new GameStruct.RoleItemInfo(); item.itemid = baseitem.id; item.postion = postion; item.stronglv = stronglv; item.gem1 = gem1; item.gem2 = gem2; item.gem3 = gem3; item.war_ghost_exp = warghost_exp * 100; item.di_attack = di_attack; item.shui_attack = shui_attack; item.huo_attack = huo_attack; item.feng_attack = feng_attack; item.amount = baseitem.amount; // item.amount = IsEquip(baseitem.id) == true ? baseitem.amount_limit : amount; //宝石属性 GameStruct.GemInfo gem = ConfigManager.Instance().GetGemInfo(item.itemid); if (gem != null) { item.gem1 = (uint)gem.type; } mDicAddItem[key] = item; //发给dbserver 通知增加这个道具 GameBase.Network.Internal.AddRoleData_Item dbitem = new GameBase.Network.Internal.AddRoleData_Item(); dbitem.item.playerid = play.GetBaseAttr().player_id; dbitem.gameid = play.GetGameID(); dbitem.item.postion = postion; dbitem.item.itemid = item.itemid; dbitem.item.stronglv = stronglv; dbitem.item.amount = amount; dbitem.sortid = key; DBServer.Instance().GetDBClient().SendData(dbitem.GetBuffer()); return item; }
//添加交易道具 public void AddTradItem(uint itemid) { PlayerObject obj = UserEngine.Instance().FindPlayerObjectToTypeID(GetTradTarget()); RoleData_Eudemon eudemon = null; if (obj == null) { return; } GameStruct.RoleItemInfo info = null; if (itemid >= IDManager.eudemon_start_id) { eudemon = play.GetEudemonSystem().FindEudemon(itemid); if (eudemon == null) { return; } info = play.GetItemSystem().FindItem(eudemon.itemid); } else { info = play.GetItemSystem().FindItem(itemid); } if (info == null) { return; } //最多二十个道具 if (mListItem.Count >= 20) { return; } //对面包裹满了- if (info.postion == NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK) { if (obj.GetItemSystem().IsItemFull()) { play.LeftNotice("对方物品栏已满,无法放置更多道具"); return; } }//幻兽栏已满 else if (info.postion == NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK) { if (obj.GetEudemonSystem().IsEudemonFull()) { play.LeftNotice("对方幻兽栏已满,无法放置更多道具"); return; } } mListItem.Add(info); //幻兽数据 //发给对方道具数据 obj.GetItemSystem().SendItemInfo(info, NetMsg.MsgItemInfo.TAG_TRADITEM); if (info.postion == NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK) { eudemon = play.GetEudemonSystem().FindEudemon(itemid); if (eudemon != null) { mListEudemon.Add(eudemon); play.GetEudemonSystem().SendLookTradEudemonInfo(obj, eudemon); } } }