//这个函数用于玩家丢弃的道具,然后又捡起来应用..所以不叠加
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;
}