GetItemSystem() public méthode

public GetItemSystem ( ) : PlayerItem
Résultat PlayerItem
        public static GameStruct.MonsterInfo GetMonsterInfo(PlayerObject _play,uint _item_id)
        {
            GameStruct.MonsterInfo MonsterInfo = null;

            GameStruct.RoleItemInfo item = _play.GetItemSystem().FindItem(_item_id);
            if (item == null)
            {
                Log.Instance().WriteLog("幻兽出征失败,无法找到道具id:" + _item_id.ToString());
                return null;
            }

            GameStruct.ItemTypeInfo baseitem = ConfigManager.Instance().GetItemTypeInfo(item.itemid);
            if (baseitem == null)
            {
                Log.Instance().WriteLog("幻兽出征失败,无法找到道具id:code:1" + item.itemid.ToString());
                return null;
            }
            MonsterInfo = ConfigManager.Instance().GetMonsterInfo(baseitem.monster_type);
            if (MonsterInfo == null)
            {
                Log.Instance().WriteLog("幻兽出征失败,无法找到怪物idid:code:1" + baseitem.monster_type.ToString());
                return null;
            }
            return MonsterInfo;
        }
        //提升装备品质
        public void EquipQuality(PlayerObject play, uint srcid, uint materialid)
        {
            const int LINGHUNJINGSHI = 1037160; //灵魂晶石ID
            const int LINGHUNWANG = 1037169;    //灵魂王
            const int SHENQIZHILEI = 1037200; //神祈之泪
               // const int HUNWUSHENQIZHILEI = 1025754; //魂武神祈之泪
            const int MAX_QUALIY = 7;    //最高品质 神器
            GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(srcid);
            GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid);
            if (item == null || materialitem == null) return;
            if (item.GetQuality() == MAX_QUALIY) return; //已达到最高品质
            int rand = GameStruct.IRandom.Random(1, 100);
            bool bUpdate = false;
            if (!play.GetItemSystem().IsEquip(item.itemid)) return; //不是装备就不提升了

            NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet();
            ret.Create(null, play.GetGamePackKeyEx());
            ret.srcid = srcid;
            ret.destid = materialid;
            ret.type = 196610;//{2,0,3,0}
            if (materialitem.itemid == LINGHUNJINGSHI ||
                materialitem.itemid == SHENQIZHILEI)
            {
                //检测是否有足够的灵魂晶石或者神祈之类
                if (!play.GetItemSystem().DeleteItemByID(materialid)) return;
                if (rand < this.RateSuccForQuality(item))
                {
                    item.UpQuality();
                    bUpdate = true;
                    ret.ret = 1;
                }
            }
            else if(materialitem.itemid == LINGHUNWANG &&
               item.GetQuality() <= 4/*极品武器以下可以用灵魂王升级*/)
            {
                //检测是否有足够的灵魂王
                 if (!play.GetItemSystem().DeleteItemByID(materialid)) return;
                item.UpQuality();
                bUpdate = true;
                ret.ret = 1;

            }
            if (bUpdate)
            {
                //锻造者名称-
                if (item.forgename.Length == 0)
                {
                    item.forgename = play.GetName();
                }
                play.GetItemSystem().UpdateItemInfo(item.id);
            }
            play.SendData(ret.GetBuffer());
        }
        //摊位出售道具
        public void SellItem(PlayerObject play, uint item_id, byte type, int price)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) == null) return;
            uint ptich_obj_id = GetPtichObjectTypeID(play.GetCurrentPtichID());
            GameStruct.RoleItemInfo item = null;
            if (ptich_obj_id == 0) return;
            if (item_id >= IDManager.eudemon_start_id)
            {

                RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(item_id);
                if (eudemon == null) return;
                item = play.GetItemSystem().FindItem(eudemon.itemid);
                if (item == null) return;
            }
            else
            {
                item = play.GetItemSystem().FindItem(item_id);
                if (item == null) return;
            }

            if (ptich_obj_id == 0) return;
            //判断是否已经在出售摊位列表中- 反作弊
            int nPtichId = play.GetCurrentPtichID();
            for (int i = 0; i < mListPtichInfo[nPtichId].mSellItemList.Count; i++)
            {
                if (mListPtichInfo[nPtichId].mSellItemList[i].item_id == item_id)
                {
                    return;
                }
            }
            //摆摊出售道具已满
            if (mListPtichInfo[nPtichId].mSellItemList.Count >= GameBase.Config.Define.PTICH_SELL_MAX_COUNT)
            {
                return;
            }
            PacketOut outpack = new PacketOut();
            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteInt32(price);
            outpack.WriteInt32(type);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            play.SendData(outpack.Flush(), true);
            //移到摊位状态
            item.postion = NetMsg.MsgItemInfo.ITEMPOSTION_PTICH_PACK;

            PtichSellItemInfo info = new PtichSellItemInfo();
            info.item_id = item_id;
            info.price = price;
            info.sell_type = type;
            mListPtichInfo[nPtichId].mSellItemList.Add(info);
            // {28,0,241,3,8,127,205,7,111,0,0,0,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
        }
        public void BuyItem(PlayerObject play, uint ptich_obj_id, uint item_id)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) != null)
            {
                play.MsgBox("摆摊中不允许购买!");
                return;
            }
            int ptich_id = -1;
            for (int i = 0; i < mListPtichInfo.Count; i++)
            {
                if (mListPtichInfo[i].PtichObj == null) continue;
                if (mListPtichInfo[i].PtichObj.GetTypeId() == ptich_obj_id)
                {
                    ptich_id = i;
                    break;
                }
            }
            if (ptich_id == -1) return;

            //检测是否有道具
            int price = 0;
            byte sell_type = 0;

            RoleItemInfo item = null;
             RoleData_Eudemon eudemon  = null;
             bool bFind = false;
            for (int i = 0; i < mListPtichInfo[ptich_id].mSellItemList.Count; i++)
            {

                if (mListPtichInfo[ptich_id].mSellItemList[i].item_id == item_id)
                {
                    bFind = true;
                    if (item_id >= IDManager.eudemon_start_id)
                    {
                        eudemon = mListPtichInfo[ptich_id].play.GetEudemonSystem().FindEudemon(item_id);
                        if (eudemon == null) return;
                        item = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem(eudemon.itemid);
                     }else
                    {
                         item = mListPtichInfo[ptich_id].play.GetItemSystem().FindItem(item_id);
                    }

                    if (item == null)
                    {
                        play.MsgBox("购买失败!");
                        return;
                    }
                    price = mListPtichInfo[ptich_id].mSellItemList[i].price;
                    sell_type = mListPtichInfo[ptich_id].mSellItemList[i].sell_type;
                    if (sell_type == NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GAMEGOLD)
                    {
                        if (price > play.GetMoneyCount(MONEYTYPE.GOLD))
                        {
                            play.MsgBox("购买失败,魔石不足!");
                            return;
                        }
                        play.ChangeMoney(MONEYTYPE.GAMEGOLD, -price);
                        mListPtichInfo[ptich_id].play.ChangeMoney(MONEYTYPE.GAMEGOLD, price);
                    }
                    else if (sell_type == NetMsg.MsgOperateItem.PTICH_SELL_ITEM_GOLD)
                    {
                        if (price > play.GetMoneyCount(MONEYTYPE.GOLD))
                        {
                            play.MsgBox("购买失败,金币不足!");
                            return;
                        }
                        play.ChangeMoney(MONEYTYPE.GOLD, -price);
                        mListPtichInfo[ptich_id].play.ChangeMoney(MONEYTYPE.GOLD, price);
                    }
                    else return;
                    mListPtichInfo[ptich_id].mSellItemList.RemoveAt(i);
                    break;
                }
            }
            if (!bFind)
            {
                play.MsgBox("购买失败,该道具已下架!");
                return;
            }

            if (item_id >= IDManager.eudemon_start_id)
            {
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK;
                play.GetEudemonSystem().AddTempEudemon(eudemon);//加到临时表

            }
            else
            {
                //添加道具
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK;

            }
            play.GetItemSystem().AwardItem(item);
            //删除卖方道具
            //刷新摊位道具栏 卖方
            GetBackItem(mListPtichInfo[ptich_id].play, item_id);
            mListPtichInfo[ptich_id].play.GetItemSystem().DeleteItemByID(item_id);

            //买方
            //{28,0,241,3,140,87,212,7,70,160,1,0,23,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0}
            PacketOut outpack = new PacketOut();
            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteUInt32(ptich_obj_id);
            outpack.WriteInt32(23); //购买完的标识
            outpack.WriteInt16(0);
            outpack.WriteInt32(1);
            outpack.WriteInt32(0);
            outpack.WriteInt16(0);
            play.SendData(outpack.Flush(), true);
               // this.LookPtich(play, ptich_obj_id);
              //  this.LookPtich(mListPtichInfo[ptich_id].play, ptich_obj_id);
        }
Exemple #5
0
        //发送玩家数据信息到dbserver 保存到数据库
        //play 玩家对象
        //isExit 是否是退出游戏 -
        public void SaveRoleData(PlayerObject play,bool isExit = false)
        {
            if (!this.IsConnect())
            {
                UserEngine.Instance().AddCachePlay(play);
                Log.Instance().WriteLog("保存玩家数据失败,dbserver未连接,已加入到数据库缓冲存储区");
                return;
            }
            //人物基本属性
            SaveRoleData_Attr data = new SaveRoleData_Attr();
            GameStruct.PlayerAttribute attr = play.GetBaseAttr();

            data.accountid = attr.account_id;
            data.IsExit = isExit;
            data.name = play.GetName();
            data.lookface = attr.lookface;
            data.hair = attr.hair;
            data.level = (byte)attr.level;
            data.exp = attr.exp;
            data.life = attr.life;
            data.mana = attr.mana;
            data.profession = attr.profession;
            data.pk = attr.pk;
            data.gold = attr.gold;
            data.gamegold = attr.gamegold;
            data.stronggold = attr.stronggold;
            data.godlevel = attr.godlevel;
            data.maxeudemon = attr.maxeudemon;
            if (play.GetGameMap() == null)
            {
                data.mapid = 1000;
                data.x = 145;
                data.y = 413;
            }
            else
            {
                data.mapid = play.GetGameMap().GetMapInfo().id;
                data.x = play.GetCurrentX();
                data.y = play.GetCurrentY();
            }

            data.hotkey = play.GetHotKeyInfo();
            data.guanjue = attr.guanjue;
            GetDBClient().SendData(data.GetBuffer());
            //保存道具信息
            play.GetItemSystem().DB_Save();
            //保存技能信息
            play.GetMagicSystem().DB_Save();
            //保存幻兽信息
            play.GetEudemonSystem().DB_Save();
            //好友信息
            play.GetFriendSystem().DB_Save();
        }
        private void Action_Eudemon_CreateEx(ActionInfo info, PlayerObject play)
        {
            String[] split = info.param.Split(' ');
            if (split.Length < 1)
            {
                Log.Instance().WriteLog("Action_Eudemon_CreateEx 参数错误" + info.param + "id" + info.id.ToString());
                return;
            }
            uint itemid = Convert.ToUInt32(split[0]);
            if (ConfigManager.Instance().GetItemTypeInfo(itemid) == null)
            {
                Log.Instance().WriteLog("Action_Eudemon_CreateEx 物品id不存在"+itemid.ToString());
                return;
            }
            byte level = 0;
            if (split.Length >= 2) level = Convert.ToByte(split[1]);
            int quality = 0;
            if (split.Length >= 3) quality = Convert.ToInt32(split[2]);
            byte wuxing = 0;
            if (split.Length >= 4) wuxing = Convert.ToByte(split[3]);

               GameStruct.RoleItemInfo item =  play.GetItemSystem().AwardItem(itemid, NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK);
               if (level != 0 || quality != 0 || wuxing != 0)
               {
               item.typeid = IDManager.CreateTypeId(OBJECTTYPE.EUDEMON);
               RoleData_Eudemon eudemon = new RoleData_Eudemon();
               eudemon.typeid = item.typeid;
               eudemon.level = level;
               eudemon.quality = quality;
               eudemon.wuxing = wuxing;
               play.GetEudemonSystem().AddTempEudemon(eudemon);

               }
        }
        //幻魔晶石 装备升级
        public void EquipLevel(PlayerObject play,uint srcid,uint materialid)
        {
            const int HUANMOJINGSHI = 1037170; //幻魔晶石id
            const int HUANMOZHIXIN = 1037179; //幻魔之心

            const int MAX_LEVEL_EQUIP1 = 9; //其他装备的提升等级
            const int MAX_LEVEL_EQUIP2 = 25; //武器的提升等级

            GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(srcid);
            GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid);
            if (item == null || materialitem == null) return;
            bool bUpdate = false;
            NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet();
            ret.Create(null, play.GetGamePackKeyEx());
            ret.srcid = srcid;
            ret.destid = materialid;
            ret.type = 196612;//{4,0,3,0}
            int l = RateSuccForEquipLevel(item);
            if (item.IsShield() || item.IsArmor() || item.IsHelmet())
            {
                if (item.GetLevel() > MAX_LEVEL_EQUIP1)
                    return ;
                if (materialitem.itemid == HUANMOZHIXIN)
                {
                    if (!play.GetItemSystem().DeleteItemByID(materialid)) return;
                    item.UpLevel();
                    bUpdate = true;
                    ret.ret = 1;
                }
                else if(materialitem.itemid == HUANMOJINGSHI)
                {
                    if (!play.GetItemSystem().DeleteItemByID(materialid)) return;
                    if (GameStruct.IRandom.Random(1, 100) < l)
                    {
                        item.UpLevel();
                        bUpdate = true;
                        ret.ret = 1;
                    }
                }

            }
            else
            {
                if (item.GetLevel() > MAX_LEVEL_EQUIP2)
                    return ;
                if (materialitem.itemid == HUANMOZHIXIN)
                {
                    if (!play.GetItemSystem().DeleteItemByID(materialid)) return;
                    item.UpLevel();
                    ret.ret = 1;
                    bUpdate = true;
                }
                else if(materialitem.itemid == HUANMOJINGSHI)
                {
                    if (!play.GetItemSystem().DeleteItemByID(materialid)) return;
                    if (GameStruct.IRandom.Random(1, 100) < l)
                    {
                        item.UpLevel();
                        ret.ret = 1;
                        bUpdate = true;
                    }
                }

            }

            if (bUpdate)
            {
                play.GetItemSystem().UpdateItemInfo(item.id);
            }
            play.SendData(ret.GetBuffer());
            return ;
        }
        private bool Action_Equip_Operation(ActionInfo info, PlayerObject play)
        {
            String[] option = info.param.Split(' ');
            String command = option[0].ToLower();
            RoleItemInfo role_item = null;
            switch (command)
            {
                case "checkequip": //检测装备位置是否存在
                    {
                        byte postion = Convert.ToByte(option[1]);
                        role_item = play.GetItemSystem().GetEquipByPostion(postion);
                        return role_item == null ? false : true;
                    }
                case "setequippro": //设置装备属性
                    {
                        byte postion = Convert.ToByte(option[1]);
                        role_item = play.GetItemSystem().GetEquipByPostion(postion);
                        if (role_item == null) return false;
                        String op = option[2];
                        bool ret = true;
                        switch (op)
                        {
                            case "shui_attack":
                                {
                                    String opex = option[3];
                                    byte v = Convert.ToByte(option[4]);
                                    switch (opex)
                                    {
                                        case "=":
                                            {    role_item.shui_attack = v;   break; }
                                        case "-":
                                            {   role_item.shui_attack -= v;     break;  }
                                        case "+":
                                            {   role_item.shui_attack += v; break; }
                                    }
                                    break;
                                }
                            case "di_attack":
                                {
                                    String opex = option[3];
                                    byte v = Convert.ToByte(option[4]);
                                    switch (opex)
                                    {
                                        case "=":    {   role_item.di_attack = v;  break;  }
                                        case "-":   {   role_item.di_attack -= v;     break; }
                                        case "+": {   role_item.di_attack += v;  break; }
                                    }
                                    break;

                                }
                            case "huo_attack":
                                {
                                    String opex = option[3];
                                    byte v = Convert.ToByte(option[4]);
                                    switch (opex)
                                    {
                                        case "=":{   role_item.huo_attack = v;  break;  }
                                        case "-": {   role_item.huo_attack -= v;   break;  }
                                        case "+":  {    role_item.huo_attack += v;     break;  }
                                    }
                                    break;

                                }
                            case "feng_attack":
                                {
                                    String opex = option[3];
                                    byte v = Convert.ToByte(option[4]);
                                    switch (opex)
                                    {
                                        case "=": {   role_item.feng_attack = v;     break;    }
                                        case "-":     {         role_item.feng_attack -= v;     break;       }
                                        case "+":  {        role_item.feng_attack += v;   break;      }
                                    }
                                    break;

                                }
                            case "hole": //装备打洞 0为第一个洞 1为第二个洞 2为第三个洞
                                {
                                   String opex = option[3];
                                    byte v = Convert.ToByte(option[4]);

                                    switch (opex)
                                    {
                                        case "=": { role_item.OpenGem(v); break; }

                                    }
                                    break;
                                }
                            default:
                                {
                                    ret = false;
                                    break;
                                }
                        }
                        play.GetItemSystem().UpdateItemInfo(role_item.id);
                        play.CalcAttribute();//重新计算属性
                        return ret;
                    }
                case "checkequippro": //获取装备属性
                    {
                        byte postion = Convert.ToByte(option[1]);
                        role_item = play.GetItemSystem().GetEquipByPostion(postion);
                        if (role_item == null) return false;
                        String op = option[2];
                        String opex = option[3];
                        int v = Convert.ToInt32(option[4]);
                        switch (op)
                        {
                            case "shui_attack":
                                {
                                    switch (opex)
                                    {
                                        case "=":
                                            { return role_item.shui_attack == v; }
                                        case ">":
                                            { return role_item.shui_attack > v;}
                                        case ">=":
                                            {return role_item.shui_attack >= v;}
                                        case "<":
                                            {return role_item.shui_attack < v;    }
                                        case "<=":
                                            {  return role_item.shui_attack <= v;}
                                        default: { break; }
                                    }
                                    break;
                                }
                            case "di_attack":
                                {
                                    switch (opex)
                                    {
                                        case "=":
                                            {     return role_item.di_attack == v; }
                                        case ">":
                                            {return role_item.di_attack > v; }
                                        case ">=":
                                            { return role_item.di_attack >= v; }
                                        case "<":
                                            {  return role_item.di_attack < v; }
                                        case "<=":
                                            { return role_item.di_attack <= v;}
                                        default: { break; }
                                    }
                                    break;
                                }
                            case "huo_attack":
                                {
                                    switch (opex)
                                    {
                                        case "=":
                                            {   return role_item.huo_attack == v; }
                                        case ">":
                                            {       return role_item.huo_attack > v; }
                                        case ">=":
                                            {     return role_item.huo_attack >= v;   }
                                        case "<":
                                            {     return role_item.huo_attack < v;  }
                                        case "<=":
                                            {    return role_item.huo_attack <= v;  }
                                        default: { break; }
                                    }
                                    break;
                                }
                            case "feng_attack":
                                {
                                    switch (opex)
                                    {
                                        case "=":      {    return role_item.feng_attack == v;  }
                                        case ">":     {     return role_item.feng_attack > v;  }
                                        case ">=":  {    return role_item.feng_attack >= v;  }
                                        case "<":  {    return role_item.feng_attack < v;  }
                                        case "<=":{       return role_item.feng_attack <= v;  }
                                        default: { break; }
                                    }
                                    break;
                                }
                            case "hole": //装备打洞数量
                                {
                                    switch (opex)
                                    {
                                        case "=": { return role_item.GetGemCount() == v; }
                                    }
                                    break;
                                }
                            default: { break; }
                        }
                        break;
                    }
            }
            return false;
        }
        //宝石替换
        public void GemReplace(PlayerObject play, byte[] data)
        {
            GameBase.Network.PackIn inpack = new GameBase.Network.PackIn(data);
            inpack.ReadInt16();
            inpack.ReadUInt32();
            uint itemid = inpack.ReadUInt32();
            RoleItemInfo src_item = play.GetItemSystem().FindItem(itemid);
            if (src_item == null)
            {
                play.MsgBox("替换失败,装备不存在。");
                return;
            }
            int gem1_type = inpack.ReadInt32();
            int gem2_type = inpack.ReadInt32();
            int gem3_type = inpack.ReadInt32();
            uint gem1_replace_id = inpack.ReadUInt32();
            uint gem2_replace_id = inpack.ReadUInt32();
            uint gem3_replace_id = inpack.ReadUInt32();

            RoleItemInfo gem1_item_info = play.GetItemSystem().FindItem(gem1_replace_id);

            RoleItemInfo gem2_item_info = play.GetItemSystem().FindItem(gem2_replace_id);

            RoleItemInfo gem3_item_info = play.GetItemSystem().FindItem(gem3_replace_id);

            //第一个洞
            if (gem1_item_info != null && gem1_item_info.IsGem())
            {
                if (src_item.GetGemCount() > 0)
                {
                    src_item.SetGemType(0, gem1_item_info.GetGemType());
                    play.GetItemSystem().DeleteItemByID(gem1_item_info.id);
                }
            }
            //第二个洞
            if (gem2_item_info != null && gem2_item_info.IsGem())
            {
                if (src_item.GetGemCount() > 1)
                {
                    src_item.SetGemType(1, gem2_item_info.GetGemType());
                    play.GetItemSystem().DeleteItemByID(gem2_item_info.id);
                }
            }
            //第三个洞
            if (gem3_item_info != null && gem3_item_info.IsGem())
            {
                if (src_item.GetGemCount() > 2)
                {
                    src_item.SetGemType(2, gem3_item_info.GetGemType());
                    play.GetItemSystem().DeleteItemByID(gem3_item_info.id);
               }
            }
            play.GetItemSystem().SendItemInfo(src_item);
            play.MsgBox("宝石替换成功");

               // src_item.SetGemType()
        }
        //宝石镶嵌
        public void GemSet(PlayerObject play, uint srcid, uint destid, byte index)
        {
            GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(destid);
            GameStruct.RoleItemInfo srcitem = play.GetItemSystem().FindItem(srcid);
            if (item == null || srcitem == null)
            {
                return;
            }
            if (!srcitem.IsGem()) return;
            if (item.GetGemCount() < index) return;
            if (item.GetGemType(index) != 255) return; //已有宝石-- 要先拆除再镶嵌

            play.GetItemSystem().DeleteItemByID(srcid);
            item.SetGemType(index, srcitem.GetGemType());

            play.GetItemSystem().UpdateItemInfo(destid);
        }
        //宝石融合
        public void GemFusion(PlayerObject play, uint destid)
        {
            //查询所需材料id
            GameStruct.ItemTypeInfo destitem = ConfigManager.Instance().GetItemTypeInfo(destid);
            GameStruct.ItemTypeInfo srcitem = ConfigManager.Instance().GetItemTypeInfo(destid - 10);
            if (destitem == null || srcitem == null)
            {
                return;
            }
            GameStruct.GemInfo geminfo = ConfigManager.Instance().GetGemInfo(destitem.id);
            if (geminfo == null) return;

            if (!play.GetItemSystem().DeleteItemByItemID(srcitem.id, geminfo.amount))
            {
                play.MsgBox("合成失败,数量不足");
                return;
            }
            //给予道具
            play.GetItemSystem().AwardItem(destitem.id,NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK);
            play.MsgBox("合成宝石成功!");
        }
        //提升神佑
        public void Equip_GodExp(PlayerObject play, uint srcid, uint destid)
        {
            RoleItemInfo srcinfo = play.GetItemSystem().FindItem(srcid);
            if (srcinfo == null) return;
            RoleItemInfo destinfo = play.GetItemSystem().FindItem(destid);
            if (destinfo == null) return;
            if (srcinfo.god_exp >=  90000)
            {
                play.MsgBox("已达到最高神佑等级");
                return;
            }

            int godlv = srcinfo.god_exp / 10000;
            int addgodexp = 0;
            switch (godlv)
            {
                case 0: { addgodexp = 1000; break; } //提升1级神佑
                case 1: { addgodexp = 500; break; } //二级
                case 2: { addgodexp = 200; break; } //三级
                case 3: { addgodexp = 125; break; }//四级
                case 4: { addgodexp = 83; break; }//五级
                case 5: { addgodexp = 55;break;} //六级
                case 6: {addgodexp = 40;break;}//七级
                case 7: { addgodexp = 28; break; }//八级
                case 8: { addgodexp = 20; break; } //九级
                default: { return; }

            }
            int rate = 1;//倍率
            switch(destinfo.itemid)
            {
                case 1037210://神谕之石
                    {
                        rate = 1;
                        break;
                    }
                case 1037260://5倍神谕之石
                    {
                        if (godlv < 3) return; //最低使用等级是3级
                        rate = 5;
                        break;
                    }
                case 1037261: //10倍神谕之石
                    {
                        if (godlv < 5) return; //最低使用等级是5级
                        rate = 10;
                        break;
                    }
                case 1037262:       //25倍神谕之石
                    {
                        if (godlv < 8) return; //最低使用等级8级
                        rate = 25;

                        break;
                    }
            }
            srcinfo.god_exp += addgodexp * rate;
            play.GetItemSystem().DeleteItemByID(destinfo.id);
              //  play.MsgBox("增加神佑经验"+(addgodexp * rate).ToString());

            play.GetItemSystem().SendItemInfo(srcinfo);

            NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet();

            ret.srcid = srcid;
            ret.destid = destid;
            byte[] index = { 7, 0, 3, 0 };

            ret.type = BitConverter.ToUInt32(index, 0);
            ret.ret = 1;
            play.SendData(ret.GetBuffer(), true);
        }
        //装备提升魔魂等级参数:玩家对象 道具基本id 道具id 是否百分百成功
        public void EquipStrong(PlayerObject play, uint srcid, uint materialid)
        {
            const int MOHUNJINGSHI = 1037150;   //魔魂晶石id
            const int MOHUNZHIXIN = 1037159; //魔魂之心id
            GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(srcid);
            GameStruct.RoleItemInfo materialitem = play.GetItemSystem().FindItem(materialid);
            if (item == null || materialitem == null) return;
            if (item.GetStrongLevel() >= MAX_STRONGLEVEL) return;
            if (item.GetStrongLevel() >= mListStrong.Count) return;
            int rand = GameStruct.IRandom.Random(1, 100);
            bool bUpdate = false;
            NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet();
            ret.Create(null, play.GetGamePackKeyEx());
            ret.srcid = srcid;
            ret.destid = materialid;
            ret.type = 196611;//{3,0,3,0}

            if (materialitem.itemid != MOHUNJINGSHI && item.GetStrongLevel() > 9) return; //大于9级后必须使用魔魂晶石提升等级
            if (materialitem.itemid == MOHUNJINGSHI)
            {
                //检测是否有足够的魔魂晶石
                if (!play.GetItemSystem().DeleteItemByID(materialid)) return;
                if (rand < mListStrong[item.GetStrongLevel()].chance)
                {
                    item.UpStrongLevel(1);
                    bUpdate = true;
                    ret.ret = 1;
                }
                else
                {
                    ret.ret = 0;
                    //强化等级9以下不往下掉了 2016.1.24
                    if (item.GetStrongLevel() > 9 && item.DecStrongLevel())
                        bUpdate = true;

                }
            }
            else if(materialitem.itemid == MOHUNZHIXIN) //魔魂之心必成功
            {
                if (!play.GetItemSystem().DeleteItemByID(materialid)) return;
                item.UpStrongLevel(1);
                bUpdate = true;
                ret.ret = 1;
            }

            if (bUpdate)
            {

                play.GetItemSystem().UpdateItemInfo(item.id);
            }

            play.SendData(ret.GetBuffer());
        }
        //格式化字符串
        public String Sprintf_string(String text, PlayerObject play)
        {
            String ret = text;
            bool bBreak = false;
            while (true)
            {
                int pos = ret.IndexOf('[');
                if (pos == -1) break;
                int endpos = ret.IndexOf(']');
                if (endpos == -1) break;
                String command = ret.Substring(pos+1, endpos - pos -1);
                String[] option = command.Split(',');
                String sReq = ret.Substring(pos, endpos - pos + 1);
                String req = "";
                switch (option[0])
                {
                    case "username": //用户名称
                        {
                            ret = ret.Replace(command, play.GetName());
                            break;
                        }
                    case "itemname": //道具名称
                        {
                            GameStruct.RoleItemInfo roleitem = play.GetItemSystem().FindItem(play.GetItemSystem().GetScriptItemId());
                            if (roleitem != null)
                            {
                                GameStruct.ItemTypeInfo baseitem = ConfigManager.Instance().GetItemTypeInfo(roleitem.itemid);
                                if (baseitem != null)
                                {
                                    req = baseitem.name;
                                }
                            }
                            ret = ret.Replace(sReq, req);
                            break;
                        }
                    case "timeout": //定时器剩余时间
                        {
                            int time_id = Convert.ToInt32(option[1]);
                            req = ScriptTimerManager.Instance().GetPlayerTimeOutS(time_id, play.GetBaseAttr().player_id).ToString()+"秒";
                            ret = ret.Replace(sReq, req);
                            break;
                        }
                    default:
                        {
                            bBreak = true;
                            break;
                        }
                }
                if (bBreak) break;

            }
            return ret;
        }
        //法宝追加
        public void Magic_Add_God(PlayerObject play, uint srcid, uint destid)
        {
            RoleItemInfo srcinfo = play.GetItemSystem().FindItem(srcid);
            if (srcinfo == null) return;
            RoleItemInfo destinfo = play.GetItemSystem().FindItem(destid);
            if (destinfo == null) return;
            if (srcinfo.stronglv >= 12)
            {
                play.MsgBox("已达到最高法宝等级");
                return;
            }
            int godlv = srcinfo.god_exp / 10000;
            int addgodexp = 0;
            switch (destinfo.itemid)
            {
                case 1037231: //+1创世水晶
                    {
                        addgodexp = 20;
                        break;
                    }
                case 1037232: //+2创世水晶
                    {
                        addgodexp = 60;
                        break;
                    }
                case 1037233: //+3创世水晶
                    {
                        addgodexp = 180;
                        break;
                    }
            }

            //这四行代码只是为了弥补之前的BUG
            if (srcinfo.itemid == GameBase.Config.Define.ITEM_DILONGZHILEI_ID && srcinfo.god_strong >= 22500)
            {
                srcinfo.god_strong = 0;
                srcinfo.stronglv++;
            }
            //---------------------------------------------------------
            if (addgodexp == 0 && srcinfo.itemid != destinfo.itemid) return;
            if (addgodexp == 0) addgodexp = 20; //默认相同法宝+20经验
            addgodexp = 1000;
            if (srcinfo.itemid == GameBase.Config.Define.ITEM_SHUGUANGZHANHUN_ID && srcinfo.god_strong >= 7500) { return ;} //已经到最高经验值
            if (srcinfo.itemid == GameBase.Config.Define.ITEM_DILONGZHILEI_ID && srcinfo.god_strong >= 22500) { return; }
            if(srcinfo.itemid == GameBase.Config.Define.ITEM_SHENGYAOFUWEN_ID && srcinfo.god_strong >= 30000){return;}
            srcinfo.god_strong += addgodexp;
            if (srcinfo.itemid == GameBase.Config.Define.ITEM_SHUGUANGZHANHUN_ID && srcinfo.god_strong >= 7500)
            {
                srcinfo.god_strong = 0;
                srcinfo.stronglv++;
            }
            if (srcinfo.itemid == GameBase.Config.Define.ITEM_DILONGZHILEI_ID && srcinfo.god_strong >= 22500)
            {
                srcinfo.god_strong = 0;
                srcinfo.stronglv++;
            }
            if (srcinfo.itemid == GameBase.Config.Define.ITEM_SHENGYAOFUWEN_ID && srcinfo.god_strong >= 30000)
            {
                srcinfo.god_strong = 0;
                srcinfo.stronglv++;
            }

            play.GetItemSystem().DeleteItemByID(destinfo.id);

            play.GetItemSystem().SendItemInfo(srcinfo);

            NetMsg.MsgEquipOperationRet ret = new NetMsg.MsgEquipOperationRet();

            ret.srcid = srcid;
            ret.destid = destid;

            byte[] ret_code = { 9, 0, 3, 0 }; ;
            ret.type = BitConverter.ToUInt32(ret_code, 0);
            ret.ret = 1;
            play.SendData(ret.GetBuffer(), true);
        }
        private bool Action_Check_Bag_Size(ActionInfo info, PlayerObject play)
        {
            String[] split = info.param.Split(' ');

            String pack = split[0];
            int nAddSize = Convert.ToInt32(split[1]);
            switch (pack.ToLower())
            {
                case "backpack": //人物背包
                    {
                        return play.GetItemSystem().GetBagCount() + nAddSize > PlayerItem.MAXBAG_COUNT;

                    }
            }
            return false;
        }
        //装备打洞 参数:玩家对象,要打洞的道具id,打的洞序号[0为第一个洞]
        public void OpenGem(PlayerObject play, uint srcid,uint destid )
        {
            const int YUEGUANGBAOHE = 723002; //月光宝盒id
            const int YUEGUANGBAOHEZENGQIANGBAN = 820300; //月光宝盒增强版 id
            const int SHENSHENGYUEGUANGBAOHE = 742178; //神圣月光宝盒
            GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(destid);
            GameStruct.RoleItemInfo srcitem = play.GetItemSystem().FindItem(srcid);
            if (item == null || srcitem == null) return;
            byte index = 0;
            switch (srcitem.itemid)
            {
                case YUEGUANGBAOHE:
                    {
                        if (item.GetGemCount() != 0) return;
                        index = 0;
                        break;
                    }
                case YUEGUANGBAOHEZENGQIANGBAN:
                    {

                        if (item.GetGemCount() != 1) return;
                        index = 1;
                        break;
                    }
                    //第三个洞 2015.11.21 道具协议有bug。 先不开
                    //11.21 开了
                case SHENSHENGYUEGUANGBAOHE:
                    {
                        if (item.GetGemCount() != 2) return;
                        index = 2;
                        break;

                    }
                //第三个洞其他协议打-- 这个不打。。-。- 2015.9.21
                default:
                    {
                        return;
                    }
            }
            play.GetItemSystem().DeleteItemByID(srcid);
            item.OpenGem(index);
            play.GetItemSystem().UpdateItemInfo(item.id);
        }
        private void Action_Eudemon_Create(ActionInfo info, PlayerObject play)
        {
            String[] split = info.param.Split(' ');
            if (split.Length < 1)
            {
                Log.Instance().WriteLog("Action_Eudemon_Create 参数错误" + info.param + "id" + info.id.ToString());
                return;
            }
            uint itemid = Convert.ToUInt32(split[0]);

            int count = 1;
            if (split.Length >= 2)
            {
                count = Convert.ToInt32(split[1]);
            }

            //幻兽背包已满
            if (play.GetItemSystem().GetEudemonCount()+ count > PlayerEudemon.MAX_EUDEMON_COUNT)
            {
                play.ChatNotice("幻兽背包已满!!");
                return;

            }

            GameStruct.ItemTypeInfo baseitem = ConfigManager.Instance().GetItemTypeInfo(itemid);
            if (baseitem == null)
            {
                Log.Instance().WriteLog("创建幻兽出错,找不到该幻兽id" + itemid.ToString());
                return;
            }
            for (int i = 0; i < count; i++)
            {
                play.GetItemSystem().AwardItem(itemid, NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK);
            }
            //   GameStruct.RoleItemInfo iteminfo = null;
            //if (itemid == 0)
            //{
            //    iteminfo  = play.GetItemSystem().FindItem(play.GetItemSystem().GetScriptItemId());
            //    if (iteminfo == null) return;
            //}
            //else //没有道具的情况下增加幻兽,要先增加道具--
            //{

            //}

            // iteminfo.postion = NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK;
            // play.GetItemSystem().UpdateItemInfo(iteminfo.id);

            //增加幻兽
            //  play.GetEudemonSystem().AddEudemon(iteminfo);
        }
Exemple #19
0
        public void SendRoleInfo(PlayerObject play)
        {
            NetMsg.MsgRoleInfo role = new NetMsg.MsgRoleInfo();
            role.Create(null, this.GetGamePackKeyEx());
            role.role_id = play.GetTypeId();
            role.x = play.GetCurrentX();
            role.y = play.GetCurrentY();
            role.armor_id = play.GetItemSystem().GetArmorLook();
            role.wepon_id = play.GetItemSystem().GetWeaponLook();
            // role.face_sex = play.GetFace();
            role.face_sex = (uint)play.GetLookFace();
            role.face_sex1 = play.GetBaseAttr().lookface;

            role.dir = play.GetDir();
            role.action = play.GetCurrentAction();
            role.guanjue = (byte)play.GetGuanJue();
            role.hair_id = play.GetBaseAttr().hair;
            role.str.Add(play.GetName());
            role.rid_id = play.GetMountID();

            //军团
            if (play.GetLegionSystem().IsHaveLegion() && play.GetLegionSystem().GetLegion() != null)
            {
                role.legion_id = play.GetLegionSystem().GetLegion().GetBaseInfo().id;
                role.legion_title = play.GetLegionSystem().GetLegion().GetBaseInfo().title;
                role.legion_place = play.GetLegionSystem().GetPlace();
                role.legion_id1 = role.legion_id;
            }

            this.SendData(role.GetBuffer());
            //发送状态
            play.GetTimerSystem().SendState(this);
            //军团名称-
            if (role.legion_id > 0)
            {
                NetMsg.MsgLegionName legion = new NetMsg.MsgLegionName();
                legion.Create(null, this.GetGamePackKeyEx());
                legion.legion_id = role.legion_id;
                legion.legion_name = play.GetLegionSystem().GetLegion().GetBaseInfo().name;
                this.SendData(legion.GetBuffer());

            }
            //加到对方玩家可视列表
            //if (!this.GetVisibleList().ContainsKey(play.GetGameID()))
            //{
            //    RefreshObject refobj = new RefreshObject();
            //    refobj.bRefreshTag = true;
            //    refobj.obj = play;
            //    this.GetVisibleList()[play.GetGameID()] = refobj;
            //}
            this.AddVisibleObject(play, true);
            //前面发送了角色的lookface 却并没有变为鬼魂状态,用这个协议号再改变一次..偷个懒 省的去分析封包结构了。
            if (play.IsDie() && play.IsGhost())
            {
                play.ChangeAttribute(UserAttribute.LOOKFACE, play.GetLookFace(), true);
            }
        }
        private void Action_Fuck_Nian(ActionInfo info, PlayerObject play)
        {
            int nLayer = Convert.ToInt32(info.param);
            int[,] dropitem = null; //1维数为道具id  2维数为概率
            switch (nLayer)
            {
                    //十一层
                case 11:
                    {
                        dropitem = new int[5, 5];
                        dropitem[0, 0] = 180000; dropitem[0, 1] = 1;
                        dropitem[1, 0] = 743388; dropitem[1, 1] = 9;
                        dropitem[2, 0] = 743382; dropitem[2, 1] = 90;
                        dropitem[3, 0] = 743381; dropitem[3, 1] = 250;
                        dropitem[4, 0] = 743380; dropitem[4, 1] = 650;
                        break;
                    }
                case 12://十二层
                    {
                        dropitem = new int[5, 5];
                        dropitem[0, 0] = 180020; dropitem[0, 1] = 1;
                        dropitem[1,0] = 743492; dropitem[1, 1] = 9;
                        dropitem[2, 0] = 743385; dropitem[2, 1] = 90;
                        dropitem[3, 0] = 743384; dropitem[3, 1] = 250;
                        dropitem[4, 0] = 743383; dropitem[4, 1] = 650;
                        break;

                    }
                case 13://十三层
                    {
                        dropitem = new int[6, 6];
                        dropitem[0, 0] = 180040; dropitem[0, 1] = 1;
                        dropitem[1, 0] = 743495; dropitem[1, 1] = 9;
                        dropitem[2, 0] = 743389; dropitem[2, 1] = 90;
                        dropitem[3, 0] = 743386; dropitem[3, 1] = 100;
                        dropitem[4, 0] = 743385; dropitem[4, 1] = 150;
                        dropitem[5, 0] = 743384; dropitem[5, 1] = 650;
                        break;
                    }
                case 14://十四层
                    {
                        dropitem = new int[5, 5];
                        dropitem[0, 0] = 180060; dropitem[0, 1] = 1;
                        dropitem[1, 0] = 743497; dropitem[1, 1] = 9;
                        dropitem[2, 0] = 743389; dropitem[2, 1] = 90;
                        dropitem[3, 0] = 743386; dropitem[3, 1] = 250;
                        dropitem[4, 0] = 743385; dropitem[4, 1] = 650;
                        break;
                    }
                case 15: //十五层
                    {
                        dropitem = new int[5, 5];
                        dropitem[0, 0] = 180080; dropitem[0, 1] = 1;
                        dropitem[1, 0] = 743500; dropitem[1, 1] = 9;
                        dropitem[2, 0] = 743491; dropitem[2, 1] = 90;
                        dropitem[3, 0] = 743390; dropitem[3, 1] = 250;
                        dropitem[4, 0] = 743387; dropitem[4, 1] = 650;
                        break;
                    }
                case 16: //十六层
                    {
                        dropitem = new int[5, 5];
                        dropitem[0, 0] = 180100; dropitem[0, 1] = 1;
                        dropitem[1, 0] = 743501; dropitem[1, 1] = 9;
                        dropitem[2, 0] = 743493; dropitem[2, 1] = 90;
                        dropitem[3, 0] = 743491; dropitem[3, 1] = 250;
                        dropitem[4, 0] = 743390; dropitem[4, 1] = 650;
                        break;
                    }
                case 17: //十七层
                    {
                        dropitem = new int[5, 5];
                        dropitem[0, 0] = 180120; dropitem[0, 1] = 1;
                        dropitem[1, 0] = 743502; dropitem[1, 1] = 9;
                        dropitem[2, 0] = 743496; dropitem[2, 1] = 90;
                        dropitem[3, 0] = 743493; dropitem[3, 1] = 250;
                        dropitem[4, 0] = 743491; dropitem[4, 1] = 650;
                        break;
                    }
                case 18://十八层
                    {
                        dropitem = new int[5, 5];
                        dropitem[0, 0] = 180140; dropitem[0, 1] = 1;
                        dropitem[1, 0] = 743503; dropitem[1, 1] = 9;
                        dropitem[2, 0] = 743499; dropitem[2, 1] = 90;
                        dropitem[3, 0] = 743497; dropitem[3, 1] = 250;
                        dropitem[4, 0] = 743494; dropitem[4, 1] = 650;
                        break;
                    }
            }

            //传送到雷鸣交易行
            play.ChangeMap(1000, 296, 520);
            if (dropitem != null)
            {
                int rand = IRandom.Random(1, 1000);
                for (int i = 0; i < 10; i++) { rand = IRandom.Random(1, 1000); }
                int add_rand = 0;
                for (int i = 0; i < dropitem.Length; i++)
                {
                    add_rand += dropitem[i, 1];
                    if (rand <= add_rand)
                    {
                        GameStruct.ItemTypeInfo typeinfo = ConfigManager.Instance().GetItemTypeInfo((uint)dropitem[i, 0]);
                        if (typeinfo == null) continue;
                        play.GetItemSystem().AwardItem((uint)dropitem[i, 0], NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK);
                        play.MsgBox("小婊砸你被打出来了!");
                        break;
                    }
                }
            }
        }
        private void Action_Item_Add(ActionInfo info, PlayerObject play)
        {
            String[] option = info.param.Split(' ');
            if (option.Length < 2)
            {
                Log.Instance().WriteLog("脚本参数错误,id:" + info.id.ToString() + " param:" + info.param);
                return;
            }
            uint itemid = Convert.ToUInt32(option[0]);
            byte postion = Convert.ToByte(option[1]);
            byte stronglv = 0;
            byte amount = 1;
            if (option.Length >= 3) amount = Convert.ToByte(option[2]);
            if (option.Length >= 4) stronglv = Convert.ToByte(option[3]);
            byte gem1 = 0;
            byte gem2 = 0;
            byte gem3 = 0;
            if (option.Length >= 5) gem1 = Convert.ToByte(option[4]);
            if (option.Length >= 6) gem2 = Convert.ToByte(option[5]);
            if (option.Length >= 7) gem3 = Convert.ToByte(option[6]);
            byte war_ghost_exp = 0;
            if (option.Length >= 8) war_ghost_exp = Convert.ToByte(option[7]);
            byte di_attack = 0;
            if (option.Length >= 9) di_attack = Convert.ToByte(option[8]);
            byte shui_attack = 0;
            byte huo_attack = 0;
            byte feng_attack = 0;
            if (option.Length >= 10) shui_attack = Convert.ToByte(option[9]);
            if (option.Length >= 11) huo_attack = Convert.ToByte(option[10]);
            if (option.Length >= 12) feng_attack = Convert.ToByte(option[11]);

            for (int i = 0; i < amount; i++)
            {
                play.GetItemSystem().AwardItem(itemid, postion, amount, stronglv, gem1, gem2, gem3, war_ghost_exp, di_attack, shui_attack, huo_attack, feng_attack);
            }

            // play.GetItemSystem().AwardItem(itemid, postion, 1, stronglv, gem1, gem2, gem3, war_ghost_exp, di_attack, shui_attack, huo_attack, feng_attack);
        }
Exemple #22
0
        private const String XPFULL = "xpfull"; //xp满 参数: xp值

        #endregion Fields

        #region Methods

        public static void ExecuteGMCommand(String str, PlayerObject play)
        {
            try
            {
                String[] option = str.Split(' ');
                String command = option[0];
                command = command.Substring(1);
                command = command.ToLower();
                switch (command)
                {
                    case AWARDITEM:
                        {
                            uint itemid;
                            byte postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK; //默认背包
                            if (option.Length >= 2)
                            {
                                itemid = Convert.ToUInt32(option[1]);
                                if (option.Length > 2) postion = Convert.ToByte(option[2]);
                                play.GetItemSystem().AwardItem(itemid, postion);
                            }

                            break;
                        }
                    case ADDMAGIC:
                        {
                            uint magicid;
                            byte level = 0;
                            uint exp = 0;
                            if (option.Length >= 2)
                            {
                                magicid = Convert.ToUInt32(option[1]);
                                if (option.Length >= 3) level = Convert.ToByte(option[2]);
                                if (option.Length >= 4) exp = Convert.ToUInt32(option[3]);
                                play.GetMagicSystem().AddMagicInfo(magicid, level, exp);
                            }
                            break;
                        }
                    case XPFULL:
                        {
                            //byte[] data1 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 28, 0, 0, 0, 30, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
                            //play.SendData(data1);

                            int exp = 100;
                            if (option.Length >= 2)
                            {
                                exp = Convert.ToInt32(option[1]);
                            }
                            play.ChangeAttribute(GameStruct.UserAttribute.XP, exp);
                            //NetMsg.MsgUserAttribute attr = new NetMsg.MsgUserAttribute();
                            //attr.Create(null, play.GetGamePackKeyEx());
                            //attr.AddAttribute(GameStruct.UserAttribute.XP, (uint)exp);
                            //attr.role_id = play.GetTypeId();
                            //play.SendData(attr.GetBuffer());
                            break;
                        }
                    case MOB:
                        {
                            if (option.Length < 2) break;

                            uint monsterid = Convert.ToUInt32(option[1]);
                            GameStruct.MonsterInfo info = ConfigManager.Instance().GetMonsterInfo(monsterid);
                            if (info == null) break;
                            MapServer.MonsterObject obj = new MapServer.MonsterObject(monsterid, info.ai,play.GetCurrentX(),play.GetCurrentY());

                            play.GetGameMap().AddObject(obj);
                            obj.Walk(GameStruct.DIR.MAX_DIRSIZE);

                            //play.SendMonsterInfo(obj);
                            //GameStruct.Action action = new GameStruct.Action(GameStruct.Action.MOVE, null);
                            //play.PushAction(action);
                            break;
                        }
                    case ADDGOLD:
                        {
                            if (option.Length < 2) break;
                            byte btype = Convert.ToByte(option[1]);
                            int count = Convert.ToInt32(option[2]);
                            if (btype == 1)//金币
                            {
                                play.ChangeAttribute(GameStruct.UserAttribute.GOLD, count);
                            }
                            else if (btype == 2)
                            {
                                play.ChangeAttribute(GameStruct.UserAttribute.GAMEGOLD, count);
                            }
                            break;
                        }
                    case FOLLOW:
                        {
                            if (option.Length < 2) break;
                            String name = option[1];
                            PlayerObject target = UserEngine.Instance().FindPlayerObjectToName(name);
                            if (target != null)
                            {
                                //在同一张地图上
                                if (target.GetGameMap().GetID() == play.GetGameMap().GetID())
                                {
                                    play.ScroolRandom(target.GetCurrentX(), target.GetCurrentY());
                                }
                                else
                                {
                                    play.ChangeMap(target.GetGameMap().GetID(), target.GetCurrentX(), target.GetCurrentY());
                                }
                            }
                            else
                            {
                                play.LeftNotice("玩家不存在,无法传送到玩家点。");
                            }
                            break;
                        }
                    case LEVEL:
                        {
                            if (option.Length < 2) break;
                            int level = Convert.ToInt32(option[1]);
                            play.ChangeAttribute(GameStruct.UserAttribute.LEVEL, level);
                            break;
                        }
                    case RELOAD:
                        {
                            String sPath = option[1];
                            ScripteManager.Instance().LoadScripteFile(sPath, true);
                            break;
                        }
                    case RELOADALL:
                        {
                            ConfigManager.Instance().ReloadAllScripte();
                            play.ChatNotice("重加载脚本成功!");
                            break;
                        }
                    case CHANGEMAP:
                        {
                            uint mapid = Convert.ToUInt32(option[1]);
                            GameMap map = MapManager.Instance().GetGameMapToID(mapid);
                            if (map == null) break;
                            short x = (short)map.GetMapInfo().recallx;
                            short y = (short)map.GetMapInfo().recally;
                            if (option.Length >= 4)
                            {
                                x = Convert.ToInt16(option[2]);
                                y = Convert.ToInt16(option[3]);
                            }
                            play.ChangeMap(mapid, x, y);
                            break;

                        }
                    case ROBOTACTION:
                        {
                            uint action_id = Convert.ToUInt32(option[1]);
                            play.PlayRobotAction(action_id);
                            break;
                        }
                    case KILLPLAY:
                        {
                            String name = option[1];
                            PlayerObject obj_play = UserEngine.Instance().FindPlayerObjectToName(option[1]);
                            if (obj_play != null)
                            {
                                obj_play.ExitGame();
                                play.MsgBox("踢出成功!");
                            }
                            else play.MsgBox("踢出失败,未找到玩家对象!");
                            break;
                        }
                    case "test":
                        {
                            //测试更改幻兽信息
                            int type = Convert.ToInt32(option[1]);
                            int value = Convert.ToInt32(option[2]);
                            //PacketOut outpack = new PacketOut(play.GetGamePackKeyEx());
                            //byte[] buff = {24,0,245,7,1,0,0,0,208,175,166,119,1,0,0,0};
                            //outpack.WriteBuff(buff);
                            //outpack.WriteInt32(type);
                            //outpack.WriteInt32(value);
                            //play.SendData(outpack.Flush());
                            PacketOut outpack = new PacketOut(play.GetGamePackKeyEx());

                            outpack.WriteUInt16(176);
                            outpack.WriteUInt16(1102);
                            outpack.WriteInt32(2005);
                            outpack.WriteByte(0);
                            outpack.WriteByte(10);
                            outpack.WriteInt16(0);
                            outpack.WriteInt32(0);
                            outpack.WriteUInt32(play.GetTypeId());
                            outpack.WriteInt32((int)1);
                            outpack.WriteUInt32(656);

                            outpack.WriteUInt32(420171);
                            //当前耐久度
                            outpack.WriteUInt16(1000);
                            //最大耐久度
                            outpack.WriteUInt16(9000);

                            byte[] data = new byte[72];
                            data[type] = (byte)value;
                            outpack.WriteBuff(data);
                            GameStruct.ItemTypeInfo baseitem = MapServer.ConfigManager.Instance().GetItemTypeInfo(420170);

                            if (baseitem != null)
                            {
                                byte[] namebyte = Coding.GetDefauleCoding().GetBytes(baseitem.name);
                                outpack.WriteBuff(namebyte);
                                data = new byte[68 - namebyte.Length];
                                outpack.WriteBuff(data);
                            }
                            else
                            {
                                data = new byte[68];
                                outpack.WriteBuff(data);
                            }
                            play.SendData(outpack.Flush());

                            // Log.Instance().WriteLog(GamePacketKeyEx.byteToText(outpack.GetNormalBuff()));

                            break;
                        }
                    case TESTCOMBO:
                        {
                            Program._Head = Convert.ToByte(option[1]);
                            Program._Tail = Convert.ToByte(option[2]);
                            break;
                        }
                    case CHANGELOOKFACE:
                        {
                            int look = Convert.ToInt32(option[1]);
                            play.ChangeAttribute(GameStruct.UserAttribute.LOOKFACE, look);
                            break;
                        }
                    case OTHERROLE:
                        {

                            //军团职位

                            // 200 普通团员
                            // 1000 军团长
                            // 690 指挥官
                            //680 荣誉指挥官

                            //收到网络协议:长度:185协议号:1014

                            //{189,0,246,3,217,168,113,0,17,152,2,0,17,152,2,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,250,17,0,0,42,0,2,0,132,66,6,0,0,0,0,0,0,0,0,0,59,1,217,1,161,0,0,0,6,5,0,0,100,0,0,0,130,20,0,0,0,7,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,130,2,0,0,0,0,0,1,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,0,1,0,0,0,250,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,8,179,224,215,211,196,167,207,192,0,0,0}
                            short legion_pos = Convert.ToInt16(option[1]);
                            PacketOut outpack = new PacketOut(play.GetGamePackKeyEx());
                            byte[] data11 = { 185, 0, 246, 3, 200, 16, 24, 0, 209, 251, 1, 0, 209, 251, 1, 0, 0, 0, 0, 0,
                                              0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                              0, 0, 0, 117, 1, 0, 0, 64, 234, 2, 0, 244, 83, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                              214, 0, 138, 0, 119, 0, 0, 0, 3, 5, 0, 0, 100, 0, 0, 0, 125, 70, 0, 0, 0, 5, 0,
                                              0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1/*军团头衔*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};// /*军团职位*//*178, 2*/,0/* 1*/,
                            byte[] data2 = {          0, 0, 0, 0, 0, /*1, 16*/0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                              0, 0, 74, 0, 255, 8, 0, 0, 117, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                              0, 0, 0, 0, 0, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 };
                            outpack.WriteBuff(data11);
                            outpack.WriteInt16(legion_pos);
                            outpack.WriteBuff(data2);
                            play.SendData(outpack.Flush());

                            //byte[] data11 = { 185, 0, 246, 3, 200, 16, 24, 0, 209, 251, 1, 0, 209, 251, 1, 0, 0, 0, 0, 0,
                            //                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                            //                    0, 0, 0, 117, 1, 0, 0, 64, 234, 2, 0, 244, 83, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                            //                    214, 0, 138, 0, 119, 0, 0, 0, 3, 5, 0, 0, 100, 0, 0, 0, 125, 70, 0, 0, 0, 5, 0,
                            //                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1/*军团头衔*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,232,3 /*军团职位*//*178, 2*/,0/* 1*/,
                            //                    0, 0, 0, 0, 0, /*1, 16*/0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                            //                    0, 0, 74, 0, 255, 8, 0, 0, 117, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                            //                    0, 0, 0, 0, 0, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 };
                            // play.GetGamePackKeyEx().EncodePacket(ref data11, data11.Length);
                            // play.SendData(data11);
                            //收到网络协议:长度:28协议号:2036

                            //byte[] data1 = {28,0,244,7,109,0,5,0,84,66,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
                            //         play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
                            //          play.SendData(data1);
                            //收到网络协议:长度:16协议号:1012

                            //byte[] data12 = {16,0,244,3,212,21,24,0,0,0,0,0,0,0,0,0};
                            //         play.GetGamePackKeyEx().EncodePacket(ref data12, data12.Length);
                            //          play.SendData(data12);
                            //收到网络协议:长度:27协议号:1015

                            byte[] data13 = { 27, 0, 247, 3, 117, 1, 0, 0, 3, 0, 1, 14, 169, 89, 211, 200, 207, 170, 161, 239, 180, 180, 187, 212, 187, 205, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data13, data13.Length);
                            play.SendData(data13);

                            //收到网络协议:长度:16协议号:2036

                            //                                        byte[] data14 = {16,0,244,7,199,0,2,0,84,66,15,0,40,0,0,0};
                            //                         play.GetGamePackKeyEx().EncodePacket(ref data14, data14.Length);
                            //                          play.SendData(data14);
                            ////收到网络协议:长度:16协议号:1034

                            //byte[] data15 = { 16, 0, 10, 4, 2, 0, 1, 0, 200, 16, 24, 0, 206, 0, 130, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data15, data15.Length);
                            //play.SendData(data15);

                            //收到网络协议:长度:16协议号:1034
                            ////
                            //                          byte[] data11 = { 16, 0, 10, 4, 2, 0, 1, 0, 200, 16, 24, 0, 224, 0, 135, 0 };
                            //                          play.GetGamePackKeyEx().EncodePacket(ref data11, data11.Length);
                            //                          play.SendData(data11);
                            //                          byte[] data1 = {187,0,246,3,58,255,230,0,17,152,2,0,17,152,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,243,2,0,0,18,0,2,0,247,65,6,0,0,0,0,0,0,0,0

                            //,0,243,0,249,0,101,0,0,0,4,5,0,0,100,0,0,0,112,20,0,0,0,5,0,5,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,200,0,3,0,0,0,0,0,1,21,0,0,0,0,0,0,0,0,0,0,0,0,0,

                            //0,0,0,0,0,0,0,0,0,91,0,127,4,0,0,243,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,6,97,118,49,51,49,52,0,0,0};
                            // byte pos = Convert.ToByte(option[1]);
                            // byte value = Convert.ToByte(option[2]);
                            // byte[] data2 = {187,0,246,3,58,255,230,0,17,152,2,0,17,152,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,243,2,0,0,18,0,2,0,247,65,6,0,0,0,0,0,0,0,0,0,243,0,249,0,101,0,0,0,4,5,0,0,100,0,0,0,112,20};
                            // byte[] data3 = new byte[90];
                            // data3[pos] = value;
                            // byte[] data4 = { 1, 6, 97, 118, 49, 51, 49, 52, 0, 0, 0 };
                            // PacketOut outpack = new PacketOut(play.GetGamePackKeyEx());
                            // outpack.WriteBuff(data2);
                            // outpack.WriteBuff(data3);
                            // outpack.WriteBuff(data4);
                            //// play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
                            // play.SendData(outpack.Flush());

                            //byte[] data2 = { 28, 0, 244, 7, 109, 0, 5, 0, 58, 255, 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length);
                            //play.SendData(data2);

                            //byte[] data3 = { 20, 0, 249, 3, 58, 255, 230, 0, 1, 0, 0, 0, 36, 0, 0, 0, 0, 4, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length);
                            //play.SendData(data3);

                            ////军团信息
                            //byte[] data4 = { 20, 0, 247, 3, 243, 2, 0, 0, 3, 0, 1, 7, 65, 198, 172, 190, 252, 205, 197, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length);
                            //play.SendData(data4);

                            //byte[] data5 = { 28, 0, 242, 3, 174, 95, 70, 0, 58, 255, 230, 0, 243, 0, 249, 0, 4, 0, 0, 0, 100, 0, 0, 0, 58, 37, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length);
                            //play.SendData(data5);

                            break;
                        }

                    case "qicheng":
                        {
                            uint rid_id = Convert.ToUInt32(option[1]);
                            //byte[] data = { 36, 0, 244, 7, 209, 0, 7, 0 };
                            //byte[] data1 = { 226, 200, 184, 119, 45, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0 };
                            //PacketOut outpack = new PacketOut(play.GetGamePackKeyEx());
                            //outpack.WriteBuff(data);
                            //outpack.WriteUInt32(play.GetTypeId());
                            //outpack.WriteUInt32(rid_id);
                            //outpack.WriteBuff(data1);

                            //play.SendData(outpack.Flush());
                            play.TakeMount(0,rid_id);
                            break;
                        }
                    case "下马":
                        {
                            play.TakeOffMount(0);
                            break;
                        }
                    case CALLSCRIPT:
                        {
                            uint scripte_id = Convert.ToUInt32(option[1]);
                            ScripteManager.Instance().ExecuteAction(scripte_id, play);
                            break;
                        }
                    case "魔龙守护":
                        {

                            //收到网络协议:长度:40协议号:1022
                            //byte[] data2 = { 40, 0, 254, 3, 0, 0, 0, 0, 84, 66, 15, 0, 0, 0, 0, 0, 67, 2, 56, 1, 21, 0, 0, 0, 105, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length);
                            //play.SendData(data2);
                            ////收到网络协议:长度:116协议号:1105
                            //byte[] data3 = { 116, 0, 81, 4, 84, 66, 15, 0, 67, 2, 56, 1, 105, 20, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 226, 200, 184, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length);
                            //play.SendData(data3);
                            ////收到网络协议:长度:20协议号:1017
                            byte[] data7 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 99, 0, 0, 0, 1, 0, 0, 0 };

                            play.GetGamePackKeyEx().EncodePacket(ref data7, data7.Length);
                            play.SendData(data7);
                            ////收到网络协议:长度:48协议号:1127
                            //8, 7,0,0
                            byte[] data4 = { 48, 0, 103, 4, 84, 66, 15, 0, 8, 7, 0, 0, 200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length);
                            play.SendData(data4);
                            ////收到网络协议:长度:48协议号:1127
                            //byte[] data5 = { 48, 0, 103, 4, 226, 200, 184, 119, 8, 7, 0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length);
                            //play.SendData(data5);
                            ////收到网络协议:长度:16协议号:1104
                            //byte[] data6 = { 16, 0, 80, 4, 84, 66, 15, 0, 114, 0, 0, 0, 105, 20, 1, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data6, data6.Length);
                            //play.SendData(data6);

                            break;
                        }
                    case TESTDIE: //测试死亡
                        {

                            //血量清零
                            //byte[] data1 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
                            //play.SendData(data1);
                            ////收到网络协议:长度:40协议号:1022
                            //                        byte[] data2 = { 40, 0, 254, 3, 0, 0, 0, 0, 200, 105, 7, 0, 84, 66, 15, 0, 47, 3, 17, 4, 2, 0, 0, 0, 233, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            //                                play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length);
                            //                        play.SendData(data2);
                            ////收到网络协议:长度:40协议号:1022
                            //参数
                            //time  0, 0, 0, 0
                            //怪物id 200, 105, 7, 0
                            //角色id 84, 66, 15, 0
                            //x 50, 3
                            //y 17, 4
                            //标记 14
                            byte[] data3 = { 40, 0, 254, 3, 0, 0, 0, 0, 200, 105, 7, 0, 84, 66, 15, 0, 50, 3, 17, 4, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length);
                            play.SendData(data3);
                            //收到网络协议:长度:20协议号:1017 --
                            //                        byte[] data4 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0 };
                            //         play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length);
                            //                        play.SendData(data4);
                            ////收到网络协议:长度:20协议号:1017
                            //                        byte[] data5 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 26, 0, 0, 0, 2, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length);
                            //play.SendData(data5);
                            //收到网络协议:长度:32协议号:1101

                            //byte[] data6 = { 32, 0, 77, 4, 248, 149, 1, 0, 204, 165, 16, 0, 50, 3, 17, 4, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data6, data6.Length);
                            //play.SendData(data6);
                            ////收到网络协议:长度:20协议号:1017
                            //byte[] data7 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 4, 0, 0, 0, 137, 172, 15, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data7, data7.Length);
                            //play.SendData(data7);
                            ////收到网络协议:长度:67协议号:1004
                            //byte[] data8 = { 67, 0, 236, 3, 0, 0, 255, 0, 213, 7, 0, 0, 173, 8, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 4, 6, 83, 89, 83, 84, 69, 77, 8, 210, 176, 177, 200, 186, 243, 204, 236, 0, 21, 196, 227, 210, 197, 202, 167, 193, 203, 50, 50, 52, 50, 54, 195, 182, 189, 240, 177, 210, 161, 163, 0, 0, 0 };

                            //play.GetGamePackKeyEx().EncodePacket(ref data8, data8.Length);
                            //play.SendData(data8);
                            //                          //收到网络协议:长度:16协议号:1012
                            //byte[] data9 = { 16, 0, 244, 3, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data9, data9.Length);
                            //play.SendData(data9);

                            // byte[] data2 = {  20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ;
                            // play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length);
                            // play.SendData(data2);

                            // byte[] data1 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            // play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
                            // play.SendData(data1);

                            // byte[] data3 = {40,0,254,3,0,0,0,0,24,87,7,0,76,152,15,0,228,3,214,1,2,0,0,0,233,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
                            // play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length);
                            // play.SendData(data3);

                            // byte[] data4 = {40,0,254,3,0,0,0,0,24,87,7,0,76,152,15,0,225,3,214,1,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
                            // play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length);
                            // play.SendData(data4);
                            // byte[] data5= {20,0,249,3, 66, 15, 0, 1,1,0,0,0,28,0,0,0,0,0,0,0};
                            // play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length);
                            // play.SendData(data5);
                            // byte[] data6 = { 20, 0, 249, 3, 66, 15, 0, 1, 1, 0, 0, 0, 26, 0, 0, 0, 2, 0, 0, 0 };
                            // play.GetGamePackKeyEx().EncodePacket(ref data6, data6.Length);
                            // play.SendData(data6);
                            // byte[] data7 = {32,0,77,4,48,101,1,0,204,165,16,0,225,3,214,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0};
                            // play.GetGamePackKeyEx().EncodePacket(ref data7, data7.Length);
                            // play.SendData(data7);
                            //byte[] data8 = {16,0,244,3, 66, 15, 0, 1,0,0,0,0,0,0,0,0};
                            //play.GetGamePackKeyEx().EncodePacket(ref data8, data8.Length);
                            //play.SendData(data8);
                            byte[] data = { 28, 0, 249, 3, 84, 66, 15, 0, 2, 0, 0, 0, 26, 0, 0, 0, 6, 0, 0, 0, 12, 0, 0, 0, 33, 92, 108, 58 };
                            play.GetGamePackKeyEx().EncodePacket(ref data, data.Length);
                            play.SendData(data);
                            break;
                        }
                    case "引诱":
                        {

                            NetMsg.MsgMonsterMagicInjuredInfo injuredInfo = new NetMsg.MsgMonsterMagicInjuredInfo();
                            injuredInfo.tag = 21;
                            //   public int time;                //时间
                            //public uint roleid;             //角色id
                            //public uint monsterid;          //怪物id
                            //public short role_x;           //角色x
                            //public short role_y;           //角色y
                            //public uint tag;                 //标记
                            //public ushort magicid;          //技能id
                            //public ushort magiclv;      //技能等级
                            //public uint injuredvalue;       //攻击伤害值
                            //public int[] param;           //未知参数
                            // 收到网络协议:长度:20协议号:1017
                            //{20,0,249,3,76,152,15,0,1,0,0,0,9,0,0,0,97,0,0,0}
                            //收到网络协议:长度:40协议号:1022
                            byte[] data1 = { 40, 0, 254, 3, 0, 0, 0, 0, 84, 66, 15, 0, 84, 66, 15, 0, 63, 3, 7, 4, 21, 0, 0, 0, 235, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
                            play.SendData(data1);
                            //收到网络协议:长度:88协议号:1105
                            byte[] data2 = { 88, 0, 81, 4, 84, 66, 15, 0, 84, 66, 15, 0, 235, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length);
                            play.SendData(data2);
                            //收到网络协议:长度:16协议号:1104
                            //                            byte[] data3 = { 16, 0, 80, 4, 84, 66, 15, 0, 83, 0, 0, 0, 235, 3, 1, 0 };
                            //                                           play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length);
                            //                            play.SendData(data3);
                            ////收到网络协议:长度:16协议号:1012
                            //                            byte[] data4 = { 16, 0, 244, 3, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            //                                                       play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length);
                            //                            play.SendData(data4);
                            //收到网络协议:长度:20协议号:1017

                            //byte[] data5 = { 20, 0, 249, 3, 76, 152, 15, 0, 1, 0, 0, 0, 28, 0, 0, 0, 30, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length);
                            //play.SendData(data5);
                            break;
                        }
                    case "骑士团守护":
                        {
                            //收到网络协议:长度:40协议号:1022
                            byte[] data1 = { 40, 0, 254, 3, 0, 0, 0, 0, 84, 66, 15, 0, 0, 0, 0, 0, 63, 2, 56, 1, 21, 0, 0, 0, 91, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
                            play.SendData(data1);
                            //收到网络协议:长度:172协议号:1105
                            byte[] data10 = { 172, 0, 81, 4, 84, 66, 15, 0, 63, 2, 56, 1, 91, 20, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 180, 11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 91, 180, 11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 92, 180, 11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, 180, 11, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data10, data10.Length);
                            play.SendData(data10);

                            //收到网络协议:长度:81协议号:2069
                            //byte[] data2 = { 81, 0, 21, 8, 90, 180, 11, 0, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 201, 5, 0, 0, 63, 2, 63, 1, 0, 0, 125, 0, 43, 42, 0, 0, 80, 159, 4, 0, 80, 159, 4, 0, 1, 0, 100, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length);
                            //play.SendData(data2);
                            //收到网络协议:长度:28协议号:1010
                            //byte[] data3 = { 28, 0, 242, 3, 6, 140, 47, 86, 90, 180, 11, 0, 63, 2, 63, 1, 1, 0, 0, 0, 43, 42, 0, 0, 115, 37, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length);
                            //play.SendData(data3);
                            //收到网络协议:长度:81协议号:2069
                            //byte[] data4 = { 81, 0, 21, 8, 91, 180, 11, 0, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 201, 5, 0, 0, 55, 2, 51, 1, 0, 0, 125, 0, 43, 42, 0, 0, 80, 159, 4, 0, 80, 159, 4, 0, 2, 0, 100, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length);
                            //play.SendData(data4);
                            //收到网络协议:长度:28协议号:1010
                            //byte[] data5 = { 28, 0, 242, 3, 6, 140, 47, 86, 91, 180, 11, 0, 55, 2, 51, 1, 2, 0, 0, 0, 43, 42, 0, 0, 115, 37, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length);
                            //play.SendData(data5);
                            //收到网络协议:长度:81协议号:2069
                            //byte[] data6 = { 81, 0, 21, 8, 92, 180, 11, 0, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 201, 5, 0, 0, 67, 2, 51, 1, 0, 0, 125, 0, 43, 42, 0, 0, 80, 159, 4, 0, 80, 159, 4, 0, 5, 0, 100, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data6, data6.Length);
                            //play.SendData(data6);
                            //收到网络协议:长度:28协议号:1010
                            //byte[] data7 = { 28, 0, 242, 3, 6, 140, 47, 86, 92, 180, 11, 0, 67, 2, 51, 1, 5, 0, 0, 0, 43, 42, 0, 0, 115, 37, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data7, data7.Length);
                            //play.SendData(data7);
                            //收到网络协议:长度:81协议号:2069
                            //byte[] data8 = { 81, 0, 21, 8, 93, 180, 11, 0, 84, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 201, 5, 0, 0, 71, 2, 59, 1, 0, 0, 125, 0, 43, 42, 0, 0, 80, 159, 4, 0, 80, 159, 4, 0, 6, 0, 100, 0, 1, 4, 210, 193, 183, 227, 0, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data8, data8.Length);
                            //play.SendData(data8);
                            //收到网络协议:长度:28协议号:1010
                            //byte[] data9 = { 28, 0, 242, 3, 6, 140, 47, 86, 93, 180, 11, 0, 71, 2, 59, 1, 6, 0, 0, 0, 43, 42, 0, 0, 115, 37, 0, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data9, data9.Length);
                            //play.SendData(data9);

                            //收到网络协议:长度:32协议号:1101 //地面持续特效
                            //176, 9, 13, 0 时间戳
                            // 176, 23, 0, 0 特效id
                            //63, 2 x坐标
                            //55,1 y坐标

                            byte[] data11 = { 32, 0, 77, 4, 176, 9, 13, 0, 176, 23, 0, 0, 63, 2, 55, 1, 0, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data11, data11.Length);
                            play.SendData(data11);
                            ////收到网络协议:长度:16协议号:1104
                            //byte[] data12 = { 16, 0, 80, 4, 84, 66, 15, 0, 89, 0, 0, 0, 91, 20, 1, 0 };
                            //play.GetGamePackKeyEx().EncodePacket(ref data12, data12.Length);
                            //play.SendData(data12);
                            break;
                        }
                    case "清除特效":
                        {
                            byte[] data11 = { 32, 0, 77, 4, 176, 9, 13, 0, 176, 23, 0, 0, 63, 2, 55, 1, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data11, data11.Length);
                            play.SendData(data11);
                            break;
                        }
                    case "下雪":
                        {

                           // 收到网络协议:长度:28协议号:1010
            //        byte[] data1 = {28,0,242,3,232,3,0,0,76,152,15,0,75,1,155,1,0,0,0,0,232,3,0,0,63,37,0,0};
            //                                     play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
            //                            play.SendData(data1);
            ////收到网络协议:长度:28协议号:1010
            //                            byte[] data2 = { 28, 0, 242, 3, 52, 159, 49, 86, 76, 152, 15, 0, 75, 1, 155, 1, 0, 0, 0, 0, 255, 255, 255, 255, 95, 37, 0, 0 };
            //                            play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length);
            //                            play.SendData(data2);
            //收到网络协议:长度:20协议号:1110
                            //地图id
                            //地图id
                            //类型

                        byte[] data3={20,0,86,4,232,3,0,0,232,3,0,0,0,0,32,0,128,0,18,0};
                              play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length);
                            play.SendData(data3);
                            break;
                        }
                    case "元素掌控":
                        {
                     //       收到网络协议:长度:40协议号:1022
                            byte[] data1 = { 40, 0, 254, 3, 186, 192, 18, 1, 84, 66, 15, 0, 0, 0, 0, 0, 93, 1, 179, 1, 21, 0, 0, 0, 180, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                               play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length);
                            play.SendData(data1);
            //收到网络协议:长度:20协议号:1017
                            byte[] data2 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 101, 0, 0, 0, 0, 2, 0, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length);
                            play.SendData(data2);
            //收到网络协议:长度:48协议号:1127
                            byte[] data3 = { 48, 0, 103, 4, 84, 66, 15, 0, 128, 81, 1, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 };
                            play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length);
                            play.SendData(data3);
                            //收到网络协议:长度:88协议号:1105
                            byte[] data4 = { 88, 0, 81, 4, 84, 66, 15, 0, 0, 0, 0, 0, 180, 20, 0, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
            play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length);
            play.SendData(data4);

            byte[] data5 = { 20, 0, 249, 3, 84, 66, 15, 0, 1, 0, 0, 0, 107, 0, 0, 0, 3, 0, 0, 0 };
            play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length);
            play.SendData(data5);
                            break;
                        }
                    case WUDI:
                        {
                            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_WUDI) != null)
                            {
                                play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_WUDI);
                                play.LeftNotice("角色已取消无敌!!!");
                            }
                            else {
                                play.GetTimerSystem().AddStatus(GameStruct.RoleStatus.STATUS_WUDI);
                                play.LeftNotice("角色已无敌!!!");
                            }
                            break;
                        }
                    case "幻兽死亡":
                        {
                            EudemonObject obj = play.GetEudemonSystem().GetBattleEudemonSystem(0);
                            if (obj == null) break;
                            GameStruct.Action action = new GameStruct.Action(GameStruct.Action.DIE);
                            obj.PushAction(action);
                            break;
                        }
                    case "幻兽技能":
                        {
                            EudemonObject obj = play.GetEudemonSystem().GetBattleEudemonSystem(0);
                            if (obj == null) break;
                            ushort magicid = Convert.ToUInt16(option[1]);
                            obj.AddMagicInfo(magicid);
                            break;
                        }
                    case "幻兽等级":
                        {
                            EudemonObject obj = play.GetEudemonSystem().GetBattleEudemonSystem(0);
                            if (obj == null) break;
                            obj.GetEudemonInfo().level = 100;
                            play.GetEudemonSystem().SendEudemonInfo(obj.GetEudemonInfo());
                            break;
                        }
                    case "怪物外观":
                        {
                            uint lookface = Convert.ToUInt32(option[1]);
                            NetMsg.MsgMonsterInfo info = new NetMsg.MsgMonsterInfo();
                            info.id = 500000;
                            info.typeid = 3020;
                            info.lookface = lookface;
                            info.x = play.GetCurrentX();
                            info.y = play.GetCurrentY();
                            info.level = 125;
                            info.maxhp =10000;
                            info.hp = 10000;
                            info.dir = 7;
                            play.SendData(info.GetBuffer(), true);
                            break;
                        }
                    case "怪物名字":
                        {
                            uint typeid = Convert.ToUInt32(option[1]);
                            NetMsg.MsgMonsterInfo info = new NetMsg.MsgMonsterInfo();
                            info.id = 500000;
                            info.typeid = typeid;
                            info.lookface = 1243;
                            info.x = play.GetCurrentX();
                            info.y = play.GetCurrentY();
                            info.level = 125;
                            info.maxhp = 10000;
                            info.hp = 10000;
                            info.dir = 7;
                            play.SendData(info.GetBuffer(), true);
                            break;
                        }
                    case "创建npc":
                        {
                            uint id = Convert.ToUInt32(option[1]);
                            NetMsg.MsgNpcInfo info = new NetMsg.MsgNpcInfo();

                            info.Init(id, play.GetCurrentX(), play.GetCurrentY(), play.GetDir());
                            play.SendData(info.GetBuffer(),true);
                            break;
                        }
                    case GETONLINECOUNT:
                        {
                            play.ChatNotice("当前在线人数:" + UserEngine.Instance().GetOnlineCount().ToString());
                            break;
                        }
                    case "名人堂":
                        {
                            //248,42,0,0  用做NPC索引ID
                            //241,73,2,0  lookface
                            //241,73,2,0  lookface
                            //0, 0, 0, 0 未知
                            //60, 156, 29, 0 动作
                            //1, 0      名人堂排名名次
                            //132,16,2,0  衣服
                            //193, 182, 6, 0 学徒杖 武器
                            //205, 10, 0, 0 战斗力
                            // 178, 2, 0, 0 未知
                            // 33, 0, 0, 0  未知
                            //101, 0        X坐标
                            // 185, 0      Y坐标
                            //132, 0, 0, 0  发型
                            byte[] data = { 195, 0, 246, 3, 248, 42, 0, 0, 241, 73, 2, 0, 241, 73, 2, 0, 0, 0, 0, 0, /*60, 156, 29, 0*/0,0,0,0, 1, 0, 205, 10, 0, 0, 0, 0, 0,
                                              0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 132, 16, 2, 0, 193, 182, 6, 0,/* 178, 2, 0, 0, 33, 0, 0, 0*/0,0,0,0,0,0,0,0,
                                              101, 0, 185, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*33, 10,*/0,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                              0, 0, 0, /*100*/0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                              0, 0, 0, 0, 0, 0, 0, 0, 0, 0/*5*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                                              14, 185, 254, 176, 205, 185, 183, 176, 188, 161, 204, 205, 185, 194, 252, 0, 0, 0 };
                            play.SendData(data, true);
                            break;
                        }
                    case NOTICE:
                        {
                            String sMsg = option[1];
                            UserEngine.Instance().SceneNotice(sMsg);
                            break;
                        }
                    case "角色属性":
                        {
                            GameStruct.UserAttribute attr = (GameStruct.UserAttribute)Convert.ToInt32(option[1]);
                            int v = Convert.ToInt32(option[2]);
                            NetMsg.MsgUserAttribute msg = new NetMsg.MsgUserAttribute();
                            msg.role_id = play.GetTypeId();
                            msg.Create(null, null);

                            msg.AddAttribute(attr, (uint)v);
                            play.SendData(msg.GetBuffer(), true);
                            break;
                        }

                }
            }
            catch (System.Exception ex)
            {
                Log.Instance().WriteLog("----------------------------------------------------------------");
                Log.Instance().WriteLog("执行GM命令出错!!" + str);
                Log.Instance().WriteLog(ex.Message);
                Log.Instance().WriteLog(ex.StackTrace);
                Log.Instance().WriteLog("----------------------------------------------------------------");
            }
        }
        private void Action_Item_Delete(ActionInfo info, PlayerObject play)
        {
            String[] option = info.param.Split(' ');

            uint itemid = Convert.ToUInt32(option[0]);
            ushort amount = 1;
            //如果为0就删除当前的脚本道具
            if (itemid == 0)
            {
                itemid = play.GetItemSystem().GetScriptItemId();
            }
            if (option.Length == 2)
            {
                amount = Convert.ToUInt16(option[1]);
            }

            GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(itemid);
            if (item == null) return;
            item.amount -= amount;
            //没有使用数量了就删除该道具
            if (item.amount == 0)
            {
                play.GetItemSystem().DeleteItemByID(item.id);
            }
            else
            {
                //更新道具信息
                play.GetItemSystem().UpdateItemInfo(item.id);
            }
        }
Exemple #24
0
        //交易
        public void Trad(PlayerObject obj)
        {
            //互换魔石
            int nGold = obj.GetTradSystem().GetTradGold();
            if (nGold > 0)
            {
                play.ChangeAttribute(GameStruct.UserAttribute.GOLD, nGold);
            }
            //魔石
            int nGameGold = obj.GetTradSystem().GetTradGameGold();
            if (nGameGold > 0)
            {
                play.ChangeAttribute(GameStruct.UserAttribute.GAMEGOLD, nGameGold);
            }
            obj.GetTradSystem().SetTradGameGold(0);
            obj.GetTradSystem().SetTradGold(0);
            //道具
            List<GameStruct.RoleItemInfo> list = obj.GetTradSystem().GetTradItem();
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].postion == NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK)
                {
                    RoleData_Eudemon eudemon = obj.GetEudemonSystem().FindEudemon(list[i].typeid);
                    if (eudemon != null)
                    {
                        play.GetEudemonSystem().AddTempEudemon(eudemon);
                    }

                }
                play.GetItemSystem().AwardItem(list[i]);
                obj.GetItemSystem().DeleteItemByID(list[i].id);

            }
            obj.GetTradSystem().ClearTradItem();
            //成功
            play.LeftNotice("交易成功");
            //关闭对话框
            SetSureTradTag(false);
            SetTradTarget(0);
            mIsTrad = false;
            byte[] data = { 16, 0, 32, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0 };
            play.GetGamePackKeyEx().EncodePacket(ref data, data.Length);
            play.SendData(data);
        }
 private bool Action_Item_Delete_Name(ActionInfo info, PlayerObject play)
 {
     String[] option = info.param.Split(' ');
     String sName = option[0];
     int nAmount = Convert.ToInt32(option[1]);
     if (nAmount <= 0)
     {
         Log.Instance().WriteLog("Action_Item_Delete_Name 参数错误");
         return false;
     }
     int count = 0;
     GameStruct.RoleItemInfo item = play.GetItemSystem().FindItem(sName,ref count);
     if (count < nAmount) return false;
     play.GetItemSystem().DeleteItemByItemName(sName, nAmount);
     return true;
 }
Exemple #26
0
        //摊位取回道具
        public void GetBackItem(PlayerObject play, uint item_id)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) == null) return;
            uint ptich_obj_id = GetPtichObjectTypeID(play.GetCurrentPtichID());
            GameStruct.RoleItemInfo item = null;
            if (ptich_obj_id == 0) return;
            if (item_id >= IDManager.eudemon_start_id)
            {

                RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(item_id);
                if (eudemon == null) return;
                item = play.GetItemSystem().FindItem(eudemon.itemid);
                if (item == null) return;
            }
            else
            {
                item = play.GetItemSystem().FindItem(item_id);
                if (item == null) return;
            }

            int nPtichId = play.GetCurrentPtichID();
            for (int i = 0; i < mListPtichInfo[nPtichId].mSellItemList.Count; i++)
            {
                if (mListPtichInfo[nPtichId].mSellItemList[i].item_id == item_id)
                {
                    mListPtichInfo[nPtichId].mSellItemList.RemoveAt(i);
                    break;
                }
            }
            //放回到包裹或幻兽背包
            if (item_id >= IDManager.eudemon_start_id)
            {
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK;

            }
            else
            {
                item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK;
            }

            PacketOut outpack = new PacketOut();
            outpack.WriteInt16(28);
            outpack.WriteInt16(1009);
            outpack.WriteUInt32(item_id);
            outpack.WriteUInt32(ptich_obj_id);
            outpack.WriteInt32((byte)NetMsg.MsgOperateItem.PTICH_GETBACK_SELLITEM);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            outpack.WriteInt32(0);
            play.SendData(outpack.Flush(), true);
        }
 //检测道具使用等级
 private bool Action_Item_Level(ActionInfo info, PlayerObject play)
 {
     uint id = play.GetItemSystem().GetScriptItemId();
     GameStruct.RoleItemInfo iteminfo = play.GetItemSystem().FindItem(id);
     if (iteminfo == null) return false;
     GameStruct.ItemTypeInfo baseinfo = ConfigManager.Instance().GetItemTypeInfo(iteminfo.itemid);
     if (baseinfo == null) return false;
     String[] option = info.param.Split(' ');
     byte level = Convert.ToByte(option[1]);
     switch (option[0])
     {
         case ">":
             {
                 return level > baseinfo.req_level;
             }
         case "<":
             {
                 return level < baseinfo.req_level;
             }
         case "=":
             {
                 return level == baseinfo.req_level;
             }
         case ">=":
             {
                 return level >= baseinfo.req_level;
             }
         case "<=":
             {
                 return level <= baseinfo.req_level;
             }
     }
     return true;
 }
Exemple #28
0
        //收摊
        //bSendData 是否回发收摊数据- 玩家下线就不发
        public void ShutPtich(PlayerObject play, bool bSendData = true)
        {
            if (play.GetTimerSystem().QueryStatus(GameStruct.RoleStatus.STATUS_PTICH) == null) return;
            uint ptich_obj_id = GetPtichObjectTypeID(play.GetCurrentPtichID());
            if (ptich_obj_id == 0) return;

            for (int i = 0; i < mListPtichInfo[play.GetCurrentPtichID()].mSellItemList.Count; i++)
            {
                 GameStruct.RoleItemInfo item = null;
                 if (mListPtichInfo[play.GetCurrentPtichID()].mSellItemList[i].item_id >= IDManager.eudemon_start_id)
                 {
                     RoleData_Eudemon eudemon = play.GetEudemonSystem().FindEudemon(
                         mListPtichInfo[play.GetCurrentPtichID()].mSellItemList[i].item_id);
                     if (eudemon == null) continue;
                     item = play.GetItemSystem().FindItem(eudemon.itemid);

                 }
                 else
                 {
                     item = play.GetItemSystem().FindItem(
                  mListPtichInfo[play.GetCurrentPtichID()].mSellItemList[i].item_id);
                 }

                if (item != null)
                {
                    //放回到包裹
                    //放回到包裹或幻兽背包
                    if (item.typeid >= IDManager.eudemon_start_id)
                    {
                        item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_EUDEMON_PACK;

                    }
                    else
                    {
                        item.postion = NetMsg.MsgItemInfo.ITEMPOSITION_BACKPACK;
                    }

                    if (bSendData)
                    {
                        PacketOut outpack = new PacketOut();
                        outpack.WriteInt16(28);
                        outpack.WriteInt16(1009);
                        outpack.WriteUInt32(item.id);
                        outpack.WriteUInt32(ptich_obj_id);
                        outpack.WriteInt32((byte)NetMsg.MsgOperateItem.PTICH_GETBACK_SELLITEM);
                        outpack.WriteInt32(0);
                        outpack.WriteInt32(0);
                        outpack.WriteInt32(0);
                        play.SendData(outpack.Flush(), true);
                    }
                }
            }
            mListPtichInfo[play.GetCurrentPtichID()].play = null;
            //移除地图对象
            play.GetGameMap().RemoveObj(mListPtichInfo[play.GetCurrentPtichID()].PtichObj);
            mListPtichInfo[play.GetCurrentPtichID()].PtichObj = null;
            mListPtichInfo[play.GetCurrentPtichID()].mSellItemList.Clear();
            if (bSendData)
            {
                PacketOut outpack = new PacketOut();
                outpack.WriteInt16(16);
                outpack.WriteInt16(2031);
                outpack.WriteUInt32(ptich_obj_id);
                outpack.WriteUInt32(play.GetTypeId());
                outpack.WriteInt32(2);
                play.SendData(outpack.Flush(), true);
            }
            //移除摆摊状态
            play.GetTimerSystem().DeleteStatus(GameStruct.RoleStatus.STATUS_PTICH);
        }
Exemple #29
0
        //查看装备- 把自身装备信息发给对方
        public void SendLookRoleInfo(PlayerObject target)
        {
            //装备属性--
            for (int i = NetMsg.MsgItemInfo.ITEMPOSITION_HELMET; i < NetMsg.MsgItemInfo.ITEMPOSTION_RUB_SHENGYAOFUWEN + 1; i++)
            {
                GameStruct.RoleItemInfo info = this.GetEquipByPostion((byte)i);
                if (info != null)
                {
                    target.GetItemSystem().SendItemInfo(info, NetMsg.MsgItemInfo.TAG_LOOKROLEINFO);
                }
            }
            //战斗力---
            //248,0,0,0 为战斗力
            //            //   收到网络协议:长度:40协议号:2036
            //248000
            byte[] data = {  1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0 };
            PacketOut outpack = new PacketOut();
            outpack.WriteInt16(40);
            outpack.WriteInt16(2036);
            outpack.WriteInt32(524359);
            outpack.WriteUInt32(play.GetTypeId());
            outpack.WriteInt32(play.GetFightSoul()); //战斗力
            outpack.WriteBuff(data);
            target.SendData(outpack.Flush(), true);

            ////收到网络协议:长度:17协议号:1015
            //            byte[] data1 = { 17, 0, 247, 3, 144, 177, 177, 5, 0, 1, 1, 4, 176, 161, 193, 200, 0 };
            //            target.SendData(data1, true);
            ////收到网络协议:长度:15协议号:1015
            //            outpack = new PacketOut();
            //            outpack.WriteInt16(15);
            //            outpack.WriteInt16(1015);
            //            outpack.WriteUInt32(play.GetTypeId());
            //            outpack.WriteInt16(16);
            //            outpack.WriteByte(1);
            //            outpack.WriteByte(2);
            //            outpack.WriteByte(206);
            //            outpack.WriteByte(222);
            //            outpack.WriteByte(0);
            //            target.SendData(outpack.Flush(), true);
        }