Esempio n. 1
0
 public void AddEudemon(RoleData_Eudemon eudemon)
 {
     mDicEudemon[eudemon.GetTypeID()] = eudemon;
     EudemonObject obj = new EudemonObject(eudemon, play);
     obj.CalcAttribute();
     mListObj.Add(obj);
     SendEudemonInfo(eudemon);
 }
Esempio n. 2
0
 //添加掉落道具信息
 public void AddDropItemObj(uint itemid,short x,short y,uint ownerid = 0,int time = 120000,GameStruct.RoleItemInfo info = null,RoleData_Eudemon eudemon = null)
 {
     DropItemObject obj = new DropItemObject(itemid, x, y,ownerid, time);
     obj.SetRoleItemInfo(info);
     obj.SetRoleEudemonInfo(eudemon);
     AddObject(obj);
     obj.RefreshVisibleObject();
     //广播给玩家
     obj.BroadcastInfo();
 }
Esempio n. 3
0
        //载入幻兽数据
        public static void LoadRoleData_Eudemon(GameBase.Network.Internal.ROLEDATE_EUDEMON info)
        {
            MySqlCommand command;
            String       _key = String.Format(MysqlString.LOADROLEDATA_EUDEMON, info.playerid);

            command = new MySqlCommand(_key, MysqlConn.GetConn());
            MysqlConn.Conn_Open();
            MySqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                if (!reader.HasRows)
                {
                    break;
                }
                GameBase.Network.Internal.RoleData_Eudemon item = new GameBase.Network.Internal.RoleData_Eudemon();
                item.id                     = reader.GetUInt32("id");
                item.itemid                 = reader.GetUInt32("itemid");
                item.name                   = reader.GetString("name");
                item.name                   = Coding.Latin1ToGB2312(item.name);
                item.phyatk_grow_rate       = reader.GetFloat("phyatk_grow_rate");
                item.phyatk_grow_rate_max   = reader.GetFloat("phyatk_grow_rate_max");
                item.magicatk_grow_rate     = reader.GetFloat("magicatk_grow_rate");
                item.magicatk_grow_rate_max = reader.GetFloat("magicatk_grow_rate_max");
                item.life_grow_rate         = reader.GetFloat("life_grow_rate");
                item.defense_grow_rate      = reader.GetFloat("defense_grow_rate");
                item.magicdef_grow_rate     = reader.GetFloat("magicdef_grow_rate");
                item.init_life              = reader.GetInt32("life");
                item.init_atk_min           = reader.GetInt32("atk_min");
                item.init_atk_max           = reader.GetInt32("atk_max");
                item.init_magicatk_min      = reader.GetInt32("magicatk_min");
                item.init_magicatk_max      = reader.GetInt32("magicatk_max");
                item.init_defense           = reader.GetInt32("defense");
                item.init_magicdef          = reader.GetInt32("magicdef");
                item.luck                   = reader.GetInt32("luck");
                item.intimacy               = reader.GetInt32("intimacy");
                item.level                  = reader.GetInt16("level");
                item.card                   = reader.GetInt32("card");
                item.exp                    = reader.GetInt32("exp");
                item.quality                = reader.GetInt32("quality");
                item.wuxing                 = reader.GetInt32("wuxing");
                item.recall_count           = reader.GetInt32("recall_count");
                info.list_item.Add(item);
            }
            MysqlConn.Conn_Close();
            command.Dispose();
            LoadRoleData_Eudemon_MagicInfo(info);
        }
Esempio n. 4
0
        public EudemonObject(RoleData_Eudemon info,PlayerObject _play)
        {
            type = OBJECTTYPE.EUDEMON;
            mInfo = info;
            play = _play;
            mPlayObject = new Dictionary<uint, PlayerObject>();
            typeid = info.GetTypeID();
            mMonsterInfo = EudemonObject.GetMonsterInfo(play, info.itemid);
            mbIsCombo = false;
            mAttackSpeed = new GameBase.Core.TimeOut();
            mAttackSpeed.SetInterval(GameBase.Config.Define.ROLE_ATTACK_SPEED);
            mAttackSpeed.Update();

            mMagicAttackSpeed = new List<GameBase.Core.TimeOut>();
            this.SetRiding(false);
            this.SetState(EUDEMONSTATE.NROMAL);
        }
Esempio n. 5
0
        //增加幻兽
        public void AddEudemon(GameStruct.RoleItemInfo item, byte level = 1, int quality = 0,byte wuxing = 0)
        {
            //创建进化后的幻兽处理-- 因为幻兽进化配置表只配置了初始幻兽的id
            String sItemID = item.itemid.ToString();
            uint nItemId = item.itemid;
            if (sItemID.Substring(sItemID.Length-1, 1) != "0")
            {
                sItemID = sItemID.Substring(0, sItemID.Length - 1) + "0";
                nItemId = Convert.ToUInt32(sItemID);
            }

            GameStruct.EudemonInfo info = ConfigManager.Instance().GetEudemonInfo(nItemId);

            if (info == null)
            {
                Log.Instance().WriteLog("创建幻兽失败,不存在的幻兽id:" + item.id.ToString());
                return;
            }
            if (mDicEudemon.ContainsKey(item.itemid))
            {
                Log.Instance().WriteLog("创建幻兽失败,重复的幻兽id:" + item.id.ToString());
                return;
            }
            GameStruct.ItemTypeInfo itembaseinfo = ConfigManager.Instance().GetItemTypeInfo(item.itemid);
            if (itembaseinfo == null)
            {
                Log.Instance().WriteLog("创建幻兽失败,找不到基础物品id:" + item.itemid.ToString());
                return;
            }
            RoleData_Eudemon data = new RoleData_Eudemon();
            data.id = 0;
            data.itemid = item.id;
            data.phyatk_grow_rate = IRandom.Random(0.5f, info.atk_grow_min);
            data.phyatk_grow_rate_max = IRandom.Random(info.atk_grow_min, info.atk_grow_max);
            data.magicatk_grow_rate = IRandom.Random(0.5f, info.magicatk_grow_min);
            data.magicatk_grow_rate_max = IRandom.Random(info.magicatk_grow_min, info.magicatk_grow_max);
            data.life_grow_rate = IRandom.Random(info.life_grow_min, info.life_grow_max);
            data.defense_grow_rate = IRandom.Random(info.defense_grow_min, info.defense_grow_max);
            data.magicdef_grow_rate = IRandom.Random(info.magicdef_grow_min, info.magicdef_grow_max);
            data.init_life = IRandom.Random(info.life_min, info.life_max);
            data.init_atk_min = IRandom.Random(info.atk_min_min, info.atk_min_max);
            data.init_atk_max = IRandom.Random(info.atk_max_min, info.atk_max_max);
            data.init_defense = IRandom.Random(info.defense_min, info.defense_max);
            data.init_magicdef = IRandom.Random(info.magicdef_min, info.magicdef_max);
            data.init_magicatk_min = IRandom.Random(info.magicatk_min_min, info.magicatk_min_max);
            data.init_magicatk_max = IRandom.Random(info.magicatk_max_min, info.magicatk_max_max);
            data.luck = IRandom.Random(1, 100); //幸运值
            data.intimacy = 150; //亲密度
            data.level = level; //等级
            //data.card = IDManager.CreateEudemonCard(); //创建身份牌号码
            data.card = 0;              //身份牌是二次进化的时候才获得-
            data.exp = 0;
            data.quality = quality; //品质在第一次进化的时候才出现
            if (wuxing == 0)
            {
                data.wuxing = IDManager.GetEudemonWuxing();
            }
            else
            {
                data.wuxing = wuxing;
            }

            data.name = itembaseinfo.name;
            data.typeid = item.typeid;
            mDicEudemon[data.GetTypeID()] = data;
            EudemonObject obj = new EudemonObject(data, play);
            obj.CalcAttribute();
            mListObj.Add(obj);
            SendEudemonInfo(data);
        }
Esempio n. 6
0
 public void AddTempEudemon(RoleData_Eudemon eudemon)
 {
     mTempDicEudemon.Add(eudemon);
 }
Esempio n. 7
0
        //发送幻兽信息到交易栏
        public void SendLookTradEudemonInfo(PlayerObject _play, RoleData_Eudemon info)
        {
            NetMsg.MsgEudemonInfo msg = new NetMsg.MsgEudemonInfo();

            msg.id = info.GetTypeID();
            msg.tag = 4;
            msg.AddAttribute(GameStruct.EudemonAttribute.Atk_Max, info.atk_max);
            msg.AddAttribute(GameStruct.EudemonAttribute.Atk_Min, info.atk_min);
            msg.AddAttribute(GameStruct.EudemonAttribute.MagicAtk_Max, info.magicatk_max);
            msg.AddAttribute(GameStruct.EudemonAttribute.MagicAtk_Min, info.magicatk_min);
            msg.AddAttribute(GameStruct.EudemonAttribute.Defense, info.defense);
            msg.AddAttribute(GameStruct.EudemonAttribute.Magic_Defense, info.magicdef);
            msg.AddAttribute(GameStruct.EudemonAttribute.Life, info.life);
            msg.AddAttribute(GameStruct.EudemonAttribute.Life_Max, info.life_max);
            msg.AddAttribute(GameStruct.EudemonAttribute.Intimacy, info.intimacy);
            msg.AddAttribute(GameStruct.EudemonAttribute.Level, info.level);
            msg.AddAttribute(GameStruct.EudemonAttribute.WuXing, info.wuxing);
            msg.AddAttribute(GameStruct.EudemonAttribute.Luck, info.luck);
            msg.AddAttribute(GameStruct.EudemonAttribute.Recall_Count, info.recall_count);
            msg.AddAttribute(EudemonAttribute.Card, info.card);
            msg.AddAttribute(EudemonAttribute.Exp, info.exp);
            msg.AddAttribute(EudemonAttribute.Quality, info.quality);
            msg.AddAttribute(EudemonAttribute.Init_Atk, info.GetInitAtk());
            msg.AddAttribute(EudemonAttribute.Init_Magic_Atk, info.GetInitMagicAtk());
            msg.AddAttribute(EudemonAttribute.Init_Defense, info.GetInitDefense());
            msg.AddAttribute(EudemonAttribute.Init_Life, info.init_life);
            msg.AddAttribute(EudemonAttribute.Life_Grow_Rate, ConvertGrowRate(info.life_grow_rate));
            msg.AddAttribute(EudemonAttribute.Atk_Min_Grow_Rate, ConvertGrowRate(info.phyatk_grow_rate));
            msg.AddAttribute(EudemonAttribute.Atk_Max_Grow_Rate, ConvertGrowRate(info.phyatk_grow_rate_max));
            msg.AddAttribute(EudemonAttribute.MagicAtk_Min_Grow_Rate, ConvertGrowRate(info.magicatk_grow_rate));
            msg.AddAttribute(EudemonAttribute.MagicAtk_Max_Grow_Rate, ConvertGrowRate(info.magicatk_grow_rate_max));
            msg.AddAttribute(EudemonAttribute.Defense_Grow_Rate, ConvertGrowRate(info.defense_grow_rate));
            msg.AddAttribute(EudemonAttribute.MagicDefense_Grow_Rate, ConvertGrowRate(info.magicdef_grow_rate));

            GameStruct.MonsterInfo _info = EudemonObject.GetMonsterInfo(play, info.itemid);
            if (_info != null)
            {
                msg.AddAttribute(EudemonAttribute.Riding, _info.eudemon_type);
            }

            _play.SendData(msg.GetBuffer(), true);
        }
Esempio n. 8
0
        //发送幻兽信息
        //info 幻兽信息
        //tag 是否发送休息标记
        //brank 是否发送排行榜信息
        public void SendEudemonInfo(RoleData_Eudemon info, bool tag = true,bool bRank = true)
        {
            if (tag)
            {
                //要设置一个标记才可以出征,,目前不知道这个消息是干什么用的为何 应该是状态之类的吧。。。(*^__^*) 嘻2015.9.28
                NetMsg.MsgEudemonTag eudemontag = new NetMsg.MsgEudemonTag();

                eudemontag.playerid = play.GetTypeId();
                eudemontag.eudemonid = info.GetTypeID();
                eudemontag.SetBreakTag();
                play.SendData(eudemontag.GetBuffer(), true);
            }

            //所有幻兽都为至尊圣兽
            if (bRank && info.quality > 0)
            {
                byte[] data1 = { 12, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 38, 0, 0 };
                PacketOut outpack = new PacketOut();
                outpack.WriteInt16(28);
                outpack.WriteInt16(1010);
                outpack.WriteUInt32(info.typeid);
                outpack.WriteUInt32(play.GetTypeId());
                outpack.WriteBuff(data1);
                play.SendData(outpack.Flush(),true);
            }
            NetMsg.MsgEudemonInfo msg = new NetMsg.MsgEudemonInfo();

            msg.id = info.GetTypeID();
            msg.AddAttribute(GameStruct.EudemonAttribute.Atk_Max, info.atk_max);
            msg.AddAttribute(GameStruct.EudemonAttribute.Atk_Min, info.atk_min);
            msg.AddAttribute(GameStruct.EudemonAttribute.MagicAtk_Max, info.magicatk_max);
            msg.AddAttribute(GameStruct.EudemonAttribute.MagicAtk_Min, info.magicatk_min);
            msg.AddAttribute(GameStruct.EudemonAttribute.Defense, info.defense);
            msg.AddAttribute(GameStruct.EudemonAttribute.Magic_Defense, info.magicdef);
            msg.AddAttribute(GameStruct.EudemonAttribute.Life, info.life);
            msg.AddAttribute(GameStruct.EudemonAttribute.Life_Max, info.life_max);
            msg.AddAttribute(GameStruct.EudemonAttribute.Intimacy, info.intimacy);
            msg.AddAttribute(GameStruct.EudemonAttribute.Level, info.level);
            msg.AddAttribute(GameStruct.EudemonAttribute.WuXing, info.wuxing);
            msg.AddAttribute(GameStruct.EudemonAttribute.Luck, info.luck);
            msg.AddAttribute(GameStruct.EudemonAttribute.Recall_Count, info.recall_count);
            msg.AddAttribute(EudemonAttribute.Card, info.card);
            msg.AddAttribute(EudemonAttribute.Exp, info.exp);
            msg.AddAttribute(EudemonAttribute.Quality, info.quality);
            msg.AddAttribute(EudemonAttribute.Init_Atk, info.GetInitAtk());
            msg.AddAttribute(EudemonAttribute.Init_Magic_Atk, info.GetInitMagicAtk());
            msg.AddAttribute(EudemonAttribute.Init_Defense, info.GetInitDefense());
            msg.AddAttribute(EudemonAttribute.Init_Life, info.init_life);
            msg.AddAttribute(EudemonAttribute.Life_Grow_Rate, ConvertGrowRate(info.life_grow_rate));
            msg.AddAttribute(EudemonAttribute.Atk_Min_Grow_Rate, ConvertGrowRate(info.phyatk_grow_rate));
            msg.AddAttribute(EudemonAttribute.Atk_Max_Grow_Rate, ConvertGrowRate(info.phyatk_grow_rate_max ));
            msg.AddAttribute(EudemonAttribute.MagicAtk_Min_Grow_Rate, ConvertGrowRate(info.magicatk_grow_rate));
            msg.AddAttribute(EudemonAttribute.MagicAtk_Max_Grow_Rate, ConvertGrowRate(info.magicatk_grow_rate_max));
            msg.AddAttribute(EudemonAttribute.Defense_Grow_Rate, ConvertGrowRate(info.defense_grow_rate ));
            msg.AddAttribute(EudemonAttribute.MagicDefense_Grow_Rate, ConvertGrowRate(info.magicdef_grow_rate));

            GameStruct.MonsterInfo _info = EudemonObject.GetMonsterInfo(play, info.itemid);
            if (_info != null)
            {
                msg.AddAttribute(EudemonAttribute.Riding, _info.eudemon_type);
            }

            play.SendData(msg.GetBuffer(),true);
        }
Esempio n. 9
0
 public void SetRoleEudemonInfo(RoleData_Eudemon eudemon)
 {
     mEudemonInfo = eudemon;
 }
 public void Create(byte[] msg)
 {
     PackIn inpack = new PackIn(msg);
     inpack.ReadUInt16();
     playerid = inpack.ReadInt32();
     key = inpack.ReadInt32();
     key2 = inpack.ReadInt32();
     int count = inpack.ReadInt32();
     for (int i = 0; i < count; i++)
     {
         RoleData_Eudemon eudemon = new RoleData_Eudemon();
         eudemon.Create(null, inpack);
         list_item.Add(eudemon);
     }
 }
Esempio n. 11
0
 //载入幻兽数据
 public static void LoadRoleData_Eudemon(GameBase.Network.Internal.ROLEDATE_EUDEMON info)
 {
     MySqlCommand command;
     String _key = String.Format(MysqlString.LOADROLEDATA_EUDEMON, info.playerid);
     command = new MySqlCommand(_key, MysqlConn.GetConn());
     MysqlConn.Conn_Open();
     MySqlDataReader reader = command.ExecuteReader();
     while (reader.Read())
     {
         if (!reader.HasRows) break;
         GameBase.Network.Internal.RoleData_Eudemon item = new GameBase.Network.Internal.RoleData_Eudemon();
         item.id = reader.GetUInt32("id");
         item.itemid = reader.GetUInt32("itemid");
         item.name = reader.GetString("name");
         item.name = Coding.Latin1ToGB2312(item.name);
         item.phyatk_grow_rate = reader.GetFloat("phyatk_grow_rate");
         item.phyatk_grow_rate_max = reader.GetFloat("phyatk_grow_rate_max");
         item.magicatk_grow_rate = reader.GetFloat("magicatk_grow_rate");
         item.magicatk_grow_rate_max = reader.GetFloat("magicatk_grow_rate_max");
         item.life_grow_rate = reader.GetFloat("life_grow_rate");
         item.defense_grow_rate = reader.GetFloat("defense_grow_rate");
         item.magicdef_grow_rate = reader.GetFloat("magicdef_grow_rate");
         item.init_life = reader.GetInt32("life");
         item.init_atk_min = reader.GetInt32("atk_min");
         item.init_atk_max = reader.GetInt32("atk_max");
         item.init_magicatk_min = reader.GetInt32("magicatk_min");
         item.init_magicatk_max = reader.GetInt32("magicatk_max");
         item.init_defense = reader.GetInt32("defense");
         item.init_magicdef = reader.GetInt32("magicdef");
         item.luck = reader.GetInt32("luck");
         item.intimacy = reader.GetInt32("intimacy");
         item.level = reader.GetInt16("level");
         item.card = reader.GetInt32("card");
         item.exp = reader.GetInt32("exp");
         item.quality = reader.GetInt32("quality");
         item.wuxing = reader.GetInt32("wuxing");
         item.recall_count = reader.GetInt32("recall_count");
         info.list_item.Add(item);
     }
     MysqlConn.Conn_Close();
     command.Dispose();
     LoadRoleData_Eudemon_MagicInfo(info);
 }
Esempio n. 12
0
 public void SetEudemonInfo(RoleData_Eudemon info)
 {
     mInfo = info;
 }
Esempio n. 13
0
        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);

               }
        }