public void DB_Update(PlayerObject play) { //发给dbserver 更新爵位信息 GameBase.Network.Internal.UPDATEGUANJUEDATA updatedb = new GameBase.Network.Internal.UPDATEGUANJUEDATA(); updatedb.info.id = (uint)play.GetBaseAttr().player_id; updatedb.info.name = play.GetName(); updatedb.info.guanjue = play.GetBaseAttr().guanjue; DBServer.Instance().GetDBClient().SendData(updatedb.GetBuffer()); }
//提取元宝 public void GetMoney(PlayerObject play) { String sAccount = play.GetBaseAttr().sAccount; if (!mDicPayRecInfo.ContainsKey(sAccount)) { play.MsgBox("没有可提取的魔石!"); return; } int gamegold = mDicPayRecInfo[sAccount].money; play.ChangeMoney(GameStruct.MONEYTYPE.GAMEGOLD, gamegold); play.MsgBox("提取魔石[" + gamegold.ToString() + "]点!"); SetPayTag(sAccount); mDicPayRecInfo.Remove(sAccount); }
public ShenYuanELing(PlayerObject _play,BaseObject _AttackTarget, short x, short y, byte dir, uint _id, int nAi_Id) : base(_id, nAi_Id,x,y, false) { type = OBJECTTYPE.CALLOBJECT; mPlay = _play; //1.5倍的血量 this.attr.life = this.attr.life_max = (int)(mPlay.GetBaseAttr().life * 1.5f); typeid = IDManager.CreateTypeId(OBJECTTYPE.GUARDKNIGHT); SetPoint(x, y); mRebirthTime = 0;//不允许复活 SetDir(dir); this.GetAi().SetAttackTarget(_AttackTarget); }
//退出队伍 public void ExitTeam(PlayerObject _play) { for (int i = 0; i < mlistMember.Count; i++) { PlayerObject play = mlistMember[i]; if (play.GetBaseAttr().player_id == _play.GetBaseAttr().player_id) { _play.SetTeam(null); mlistMember.RemoveAt(i); break; } } //队伍人数不足就解散队伍 if (mlistMember.Count == 0) { DeleteTeam(); } }
private bool Action_CheckLevel(ActionInfo info, PlayerObject play) { String[] str = info.param.Split(' '); if (str.Length == 2) { byte level = Convert.ToByte(str[1]); switch (str[0]) { case "<": { return play.GetBaseAttr().level < level; } case "=": { return play.GetBaseAttr().level == level; } case ">": { return play.GetBaseAttr().level > level; } } } return false; }
//格式化字符串 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 SendGuanJueInfo(PlayerObject play) { // byte[] data1 = { 25, 0, 247, 3, 0, 0, 0, 0, 113, 0, 1, 12, 49, 32, 45, 49, 32, 51, 48, 48, 48, 48, 48, 48, 0 }; //捐献的 ulong guanjue = play.GetBaseAttr().guanjue; byte[] byte_ = Coding.GetDefauleCoding().GetBytes(guanjue.ToString()); GameBase.Network.PacketOut outpack = new GameBase.Network.PacketOut(play.GetGamePackKeyEx()); outpack.WriteUInt16((ushort)(byte_.Length + 4 + 14)); outpack.WriteUInt16(1015); outpack.WriteUInt32(0); outpack.WriteUInt16(113); outpack.WriteByte(1); //长度-- outpack.WriteByte((byte)(byte_.Length + 5)); String sjuewei = ((byte)play.GetGuanJue()).ToString(); byte[] jueweibyte_ = Coding.GetDefauleCoding().GetBytes(sjuewei); outpack.WriteByte(jueweibyte_[0]); //爵位 outpack.WriteByte(32); //分隔符 outpack.WriteByte(45); outpack.WriteByte(49); outpack.WriteByte(32); //分隔符 outpack.WriteBuff(byte_); outpack.WriteByte(0); play.SendData(outpack.Flush()); }
//退出军团 public void QuitLegion(PlayerObject play) { Legion legion = play.GetLegionSystem().GetLegion(); if(legion == null)return; uint legion_id = legion.GetBaseInfo().id; play.GetLegionSystem().SetLegion(null,true); int player_id = play.GetBaseAttr().player_id; for (int i = 0; i < legion.GetBaseInfo().list_member.Count; i++) { if (legion.GetBaseInfo().list_member[i].members_name == play.GetName()) { legion.GetBaseInfo().list_member[i].id = 0; break; } } this.UpdateLegionInfo(legion_id, player_id); }
public void AddTempPlayObject(GameBase.Network.Internal.RoleInfo info) { TempPlayObject temp = new TempPlayObject(); PlayerObject play = new PlayerObject(); temp.play = play; temp.key = info.mKey; temp.key2 = info.mKey1; temp.isRole = info.isRole; temp.accountid = info.accountid; //基本属性 m_DicTempPlayObject[play.GetGameID()] = temp; if (temp.isRole) { play.SetName(info.name); GameStruct.PlayerAttribute attr = play.GetBaseAttr(); attr.account_id = info.accountid; attr.player_id = info.playerid; attr.mana = info.mana; attr.lookface = info.lookface; attr.hair = info.hair; attr.profession = info.profession; attr.level = info.lv; attr.exp = (int)info.exp; attr.life = info.life; attr.pk = info.pk; attr.gold = info.gold; attr.gamegold = info.gamegold; attr.stronggold = info.stronggold; attr.mapid = (uint)info.mapid; attr.guanjue = info.guanjue; attr.sAccount = info.sAccount; attr.godlevel = (byte)info.godlevel; attr.maxeudemon = info.maxeudemon; play.SetHotKeyInfo(info.hotkey); play.CalcSex(); play.SetPoint(info.x, info.y); //官爵信息 GameStruct.GUANGJUELEVEL gjlevel = GuanJueManager.Instance().GetLevel(play); play.SetGuanJue(gjlevel); //初始化军团信息 play.GetLegionSystem().Init(); } }
//发送玩家数据信息到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(); }
public bool Action_Legion_Create(ActionInfo info, PlayerObject play) { String legionname = mszStr; mszStr = ""; if (legionname.Length <= 0) return false; if (play.GetLegionSystem().IsHaveLegion()) { return false; } //是否有重复的军团 if (LegionManager.Instance().IsExist(legionname)) { return false; } String[] option = info.param.Split(' '); int level = Convert.ToInt32(option[0]);//创建军团所需等级 int money = Convert.ToInt32(option[1]); //创建军团的费用 int capital = Convert.ToInt32(option[2]); //军团起始资金 if (play.GetBaseAttr().level < level ) { return false; } if (play.GetMoneyCount(MONEYTYPE.GOLD) < money ) { return false; } play.ChangeMoney(MONEYTYPE.GOLD, money); LegionManager.Instance().CreateLegion(play.GetBaseAttr().player_id, legionname,play.GetName(), GameBase.Config.Define.LEGION_JUNTUAN, capital, "公告"); //发给数据库服务器创建军团 return true; //246, 0, 0, 0 为军团id //1107 为军团协议 // 收到网络协议:长度:16协议号:1302 // byte[] dat1 = {16,0,22,5,61,2,0,0,182,113,0,0,88,2,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref dat1, dat1.Length); // play.SendData(dat1); // //收到网络协议:长度:20协议号:1017 // byte[] dat2 = { 20, 0, 249, 3, 64, 66, 15, 0, 1, 0, 0, 0, 9, 0, 0, 0, 100, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref dat2, dat2.Length); // play.SendData(dat2); ////收到网络协议:长度:20协议号:1017 // byte[] dat3 = {20,0,249,3,65,66,15,0,1,0,0,0,70,0,0,0,64,0,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref dat3, dat3.Length); // play.SendData(dat3); ////收到网络协议:长度:16协议号:1012 // byte[] dat4 = { 16, 0, 244, 3, 64, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref dat4, dat4.Length); // play.SendData(dat4); //收到网络协议:长度:108协议号:1106/ //头衔注释 //0.1.军团长 2.帮主 3.教主 4.会长 // byte[] dat5 = {108,0,82,4,246,0,0,0,144,208,3,0,144,208,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,232,3,1,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,210,176,177,200,186,243,204,236,0,0,0,0,0,0,0,0,0,0,246,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //byte[] dat5 = { 108, 0, 82, 4, 246, 0, 0, 0, 144, 208, 3, 0, 144, 208, 3, 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, 4/*!!!头衔*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 210, 176, 177, 200, 186, 243, 204, 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 246, 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 dat5, dat5.Length); //play.SendData(dat5); //收到网络协议:长度:21协议号:1015 //{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} //byte[] data10 = { 21, 0, 247, 3, 246, 0, 0, 0, 3, 0, 1, 8, 196, 234, 201, 217, 187, 196, 204, 198, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data10, data10.Length); //play.SendData(data10); //收到网络协议:长度:172协议号:2056 // byte[] dat6 = { 172, 0, 8, 8, 64, 66, 15, 0, 20, 0, 0, 0, 3, 0, 0, 0, 144, 208, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 144, 208, 3, 0, 11, 0, 0, 0, 144, 208, 3, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref dat6, dat6.Length); // play.SendData(dat6); ////收到网络协议:长度:108协议号:1106 // byte[] dat7 = {108,0,82,4,246,0,0,0,144,208,3,0,144,208,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,232,3,0,0,0,0,232,3,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,210,176,177,200,186,243,204,236,0,0,0,0,0,0,0,0,0,0,246,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 dat7, dat7.Length); // play.SendData(dat7); ////收到网络协议:长度:172协议号:2056 // byte[] dat8 = { 172, 0, 8, 8, 64, 66, 15, 0, 20, 0, 0, 0, 3, 0, 0, 0, 144, 208, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 144, 208, 3, 0, 11, 0, 0, 0, 144, 208, 3, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref dat8, dat8.Length); // play.SendData(dat8); ////收到网络协议:长度:108协议号:1106 // byte[] dat9={108,0,82,4,246,0,0,0,144,208,3,0,160,247,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,232,3,0,0,0,0,232,3,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,210,176,177,200,186,243,204,236,0,0,0,0,0,0,0,0,0,0,246,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 dat9, dat9.Length); // play.SendData(dat9); ////收到网络协议:长度:172协议号:2056 // byte[] dat10 = { 172, 0, 8, 8, 64, 66, 15, 0, 20, 0, 0, 0, 3, 0, 0, 0, 144, 208, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 144, 208, 3, 0, 11, 0, 0, 0, 144, 208, 3, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref dat10, dat10.Length); // play.SendData(dat10); ////收到网络协议:长度:108协议号:1106 // byte[] dat11={108,0,82,4,246,0,0,0,144,208,3,0,160,247,3,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,232,3,0,0,0,0,232,3,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,210,176,177,200,186,243,204,236,0,0,0,0,0,0,0,0,0,0,246,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 dat11, dat11.Length); // play.SendData(dat11); //收到网络协议:长度:172协议号:2056 // byte[] dat12 = { 172, 0, 8, 8, 64, 66, 15, 0, 20, 0, 0, 0, 3, 0, 0, 0, 144, 208, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 144, 208, 3, 0, 11, 0, 0, 0, 144, 208, 3, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref dat12, dat12.Length); // play.SendData(dat12); ////收到网络协议:长度:189协议号:1014 // byte[] dat13 = { 189, 0, 246, 3, 64, 66, 15, 0, 33, 191, 2, 0, 33, 191, 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, 246, 0, 0, 0, 21, 0, 2, 0, 102, 66, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 0, 114, 1, 132, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 97, 20, 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, 232, 3, 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, 197, 10, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 210, 176, 177, 200, 186, 243, 204, 236, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref dat13, dat13.Length); // play.SendData(dat13); ////收到网络协议:长度:46协议号:1004 // byte[] dat15 = { 46, 0, 236, 3, 0, 255, 255, 0, 63, 8, 0, 0, 71, 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, 0, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref dat15, dat15.Length); // play.SendData(dat15); //收到网络协议:长度:16协议号:1015 //byte[] data = { 16, 0, 247, 3, 1, 0, 0, 0, 101, 0, 1, 3, 50, 52, 54, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data, data.Length); //play.SendData(data); ////收到网络协议:长度:16协议号:1015 //byte[] data1 = { 16, 0, 247, 3, 1, 0, 0, 0, 100, 0, 1, 3, 50, 52, 54, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data1, data1.Length); //play.SendData(data1); //收到网络协议:长度:29协议号:1107 //byte[] data2 = { 29, 0, 83, 4, 14, 0, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 196, 234, 201, 217, 187, 196, 204, 198, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data2, data2.Length); //play.SendData(data2); //收到网络协议:长度:20协议号:1107 //byte[] data3 = { 20, 0, 83, 4, 119, 0, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data3, data3.Length); //play.SendData(data3); //收到网络协议:长度:16协议号:2036 //byte[] data4 = { 16, 0, 244, 7, 205, 0, 2, 0, 246, 0, 0, 0, 0, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data4, data4.Length); //play.SendData(data4); ////收到网络协议:长度:56协议号:2036 //byte[] data5 = { 56, 0, 244, 7, 210, 0, 12, 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, 246, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data5, data5.Length); //play.SendData(data5); //收到网络协议:长度:12协议号:1015 //byte[] data6 = { 12, 0, 247, 3, 0, 0, 0, 0, 152, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data6, data6.Length); //play.SendData(data6); ////收到网络协议:长度:20协议号:1017 //byte[] data7 = { 20, 0, 249, 3, 64, 66, 15, 0, 1, 0, 0, 0, 4, 0, 0, 0, 11, 139, 16, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data7, data7.Length); //play.SendData(data7); //收到网络协议:长度:74协议号:1107 // byte[] data8 = { 74, 0, 83, 4, 171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 5, 48, 32, 48, 32, 48, 5, 49, 32, 48, 32, 48, 5, 50, 32, 48, 32, 48, 5, 51, 32, 48, 32, 48, 5, 52, 32, 48, 32, 48, 5, 53, 32, 48, 32, 48, 5, 54, 32, 48, 32, 48, 5, 55, 32, 48, 32, 48, 5, 56, 32, 48, 32, 48, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data8, data8.Length); // play.SendData(data8); //// ////收到网络协议:长度:16协议号:1182 //// // byte[] data9 = { 16, 0, 158, 4, 7, 0, 0, 0, 232, 3, 0, 0, 3, 0, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data9, data9.Length); // play.SendData(data9); //收到网络协议:长度:16协议号:1302 // // byte[] data11 = { 16, 0, 22, 5, 61, 2, 0, 0, 253, 101, 0, 0, 88, 2, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data11, data11.Length); // play.SendData(data11); ////收到网络协议:长度:28协议号:1010 //// // byte[] data12 = { 28, 0, 242, 3, 118, 202, 19, 86, 65, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data12, data12.Length); // play.SendData(data12); //收到网络协议:长度:28协议号:1010 // // byte[] data13 = { 28, 0, 242, 3, 118, 202, 19, 86, 65, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data13, data13.Length); // play.SendData(data13); ////收到网络协议:长度:28协议号:1010 //// // byte[] data14 = { 28, 0, 242, 3, 118, 202, 19, 86, 194, 148, 53, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data14, data14.Length); // play.SendData(data14); //收到网络协议:长度:28协议号:1010 // // byte[] data15 = { 28, 0, 242, 3, 118, 202, 19, 86, 193, 148, 53, 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 37, 0, 0 }; // play.GetGamePackKeyEx().EncodePacket(ref data15, data15.Length); // play.SendData(data15); ////收到网络协议:长度:20协议号:1017 ////{ // byte[] data16 ={20,0,249,3,65,66,15,0,1,0,0,0,70,0,0,0,64,0,0,0}; // play.GetGamePackKeyEx().EncodePacket(ref data16, data16.Length); // play.SendData(data16); //收到网络协议:长度:192协议号:1014 天晴猪宝贝 //byte[] data17 ={192,0,246,3,65,66,15,0,3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,64,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,132,16,2,0,0,0,0,0,0,0,0,0,0,0,0,0,159,0,110,1,100,0,0,0,0,5,0,0,0,0,0,0,125,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,0,0,0,0,0,0,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,197,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,0,0,1,11,183,201,184,235,54,50,56,91,71,77,93,0,0,0}; //play.GetGamePackKeyEx().EncodePacket(ref data17, data17.Length); //play.SendData(data17); // //收到网络协议:长度:28协议号:2036 // //byte[] data18= { 28, 0, 244, 7, 109, 0, 5, 0, 65, 66, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data18, data18.Length); //play.SendData(data18); //收到网络协议:长度:28协议号:1017 // //byte[] data19 = { 28, 0, 249, 3, 65, 66, 15, 0, 2, 0, 0, 0, 36, 0, 0, 0, 0, 4, 0, 0, 70, 0, 0, 0, 64, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data19, data19.Length); //play.SendData(data19); //收到网络协议:长度:108协议号:1106 //这个是更改军团头衔 会长 军团战 帮主之类的 //byte[] data20 = { 108, 0, 82, 4, 246, 0, 0, 0, 144, 208, 3, 0, 160, 247, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 232, 3, 0, 0, 0, 0, 232, 3, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 210, 176, 177, 200, 186, 243, 204, 236, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 246, 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 data20, data20.Length); //play.SendData(data20); //收到网络协议:长度:172协议号:2056 //byte[] data21 = { 172, 0, 8, 8, 76, 152, 15, 0, 20, 0, 0, 0, 3, 0, 0, 0, 144, 208, 3, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 0, 144, 208, 3, 0, 11, 0, 0, 0, 144, 208, 3, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, 0, 0, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data21, data21.Length); //play.SendData(data21); // //收到网络协议:长度:189协议号:1014 野比后天 //byte[] data22 = { 189, 0, 246, 3, 76, 152, 15, 0, 33, 191, 2, 0, 33, 191, 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, 246, 0, 0, 0, 21, 0, 2, 0, 102, 66, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 0, 114, 1, 132, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 97, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 232, 3, 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, 197, 10, 0, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 8, 210, 176, 177, 200, 186, 243, 204, 236, 0, 0, 0 }; //play.GetGamePackKeyEx().EncodePacket(ref data22, data22.Length); //play.SendData(data22); // //return true; }
//检测玩家属性 private bool Action_Get_Role_Pro(ActionInfo info, PlayerObject play) { String[] option = info.param.Split(' '); if (option.Length != 3) { Log.Instance().WriteLog("参数错误:Action_Get_Role_Pro" + info.param); return false; } String op = option[0]; int nParam = Convert.ToInt32(option[2]); switch (op) { case "gold": { switch (option[1]) { case ">": { return play.GetBaseAttr().gold > nParam; } case "<": { return play.GetBaseAttr().gold < nParam; } case "=": { return play.GetBaseAttr().gold == nParam; } case ">=": { return play.GetBaseAttr().gold >= nParam; } case "<=": { return play.GetBaseAttr().gold <= nParam; } } break; } case "gamegold": { switch (option[1]) { case ">": { return play.GetBaseAttr().gamegold > nParam; } case "<": { return play.GetBaseAttr().gamegold < nParam; } case "=": { return play.GetBaseAttr().gamegold == nParam; } case ">=": { return play.GetBaseAttr().gamegold >= nParam; } case "<=": { return play.GetBaseAttr().gamegold <= nParam; } } break; } case "level": { switch (option[1]) { case ">": { return play.GetBaseAttr().level > nParam; } case "<": { return play.GetBaseAttr().level < nParam; } case "=": { return play.GetBaseAttr().level == nParam; } case ">=": { return play.GetBaseAttr().level >= nParam; } case "<=": { return play.GetBaseAttr().level <= nParam; } } break; } case "godlevel": { switch (option[1]) { case ">": { return play.GetBaseAttr().godlevel > nParam; } case "<": { return play.GetBaseAttr().godlevel < nParam; } case "=": { return play.GetBaseAttr().godlevel == nParam; } case ">=": { return play.GetBaseAttr().godlevel >= nParam; } case "<=": { return play.GetBaseAttr().godlevel <= nParam; } } break; } case "pk": { switch (option[1]) { case ">": { return play.GetBaseAttr().pk > nParam; } case "<": { return play.GetBaseAttr().pk < nParam; } case "=": { return play.GetBaseAttr().pk > nParam; } case ">=": { return play.GetBaseAttr().pk >= nParam; } case "<=": { return play.GetBaseAttr().pk <= nParam; } } break; } case "maxeudemon": { switch (option[1]) { case ">": { return play.GetBaseAttr().maxeudemon > nParam; } case "<": { return play.GetBaseAttr().maxeudemon < nParam; } case "=": { return play.GetBaseAttr().maxeudemon == nParam; } case ">=": { return play.GetBaseAttr().maxeudemon >= nParam; } case "<=": { return play.GetBaseAttr().maxeudemon <= nParam; } } break; } //case "battle_eudemon_count": //出战幻兽 // { // //switch (option[1]) // //{ // //} // break; // } } return false; }
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); } }
//玩家捐献爵位 public void Donation(PlayerObject play, GameStruct.MONEYTYPE type, int value) { const int MIN_GOLD = 3000000; //最低捐献金额- 防封包 GameStruct.GUANGJUELEVEL oldlv = play.GetGuanJue(); int gold = 0; switch (type ) { case GameStruct.MONEYTYPE.GOLD: { if (gold < MIN_GOLD) { play.LeftNotice("最低捐献" + MIN_GOLD.ToString() + "万金币起。"); return; } if (play.GetMoneyCount(GameStruct.MONEYTYPE.GOLD) < value) { play.LeftNotice("金币不足,无法捐献!"); return; } gold = value; play.ChangeAttribute(GameStruct.UserAttribute.GOLD, -gold); break; } case GameStruct.MONEYTYPE.GAMEGOLD: { if (play.GetMoneyCount(GameStruct.MONEYTYPE.GAMEGOLD) < value) { play.LeftNotice("魔石不足,无法捐献!"); return; } play.ChangeAttribute(GameStruct.UserAttribute.GAMEGOLD, -value); //转换成金币 一个魔石等于7100金币 const int _gold = 7100; gold = value * _gold; if (gold < MIN_GOLD) { play.LeftNotice("最低捐献"+MIN_GOLD.ToString()+"万金币起。"); return; } break; } } play.GetBaseAttr().guanjue += (uint)gold; SetValue(play.GetBaseAttr().player_id,play.GetName() ,play.GetBaseAttr().guanjue); //通知客户端 //重新计算一下等级 GameStruct.GUANGJUELEVEL level = this.GetLevel(play); //爵位被改变- 发公告 if (oldlv != level) { this.SendChangeGuanJueMsg(play, level); } if (level != play.GetGuanJue()) { play.SetGuanJue(level); } this.SendGuanJueInfo(play); DB_Update(play); }
private bool Action_CheckProfession(ActionInfo info, PlayerObject play) { byte nProfession = Convert.ToByte(info.param); if (play.GetBaseAttr().profession == nProfession) { return true; } return false; }
private bool Action_Magic_Operation(ActionInfo info,PlayerObject play) { bool ret = true; String[] split = info.param.Split(' '); String command = split[0]; switch (command.ToLower()) { case "learnmagic": { byte profession = Convert.ToByte(split[1]); uint magic_id = Convert.ToUInt32(split[2]); byte level = Convert.ToByte(split[3]); uint exp = Convert.ToUInt32(split[4]); GameStruct.MagicTypeInfo type_info = ConfigManager.Instance().GetMagicTypeInfo(magic_id); if (type_info == null) return false; if (play.GetBaseAttr().profession != profession) { ret = false; play.LeftNotice("职业不符,无法学习技能"); break; } //if (play.GetBaseAttr().level < type_info.need_level) //{ // ret = false; // play.LeftNotice("等级不足,无法学习!"); // break; //} if (play.GetMagicSystem().isMagic(magic_id)) { ret = false; play.LeftNotice("你已经学会了" + type_info.name + ",请勿重复学习!"); break; } play.GetMagicSystem().AddMagicInfo(magic_id, level, exp); play.LeftNotice("恭喜阁下学会" + type_info.name); break; } } return ret; }
//设置玩家属性 private void Action_Set_Role_Pro(ActionInfo info, PlayerObject play) { String[] option = info.param.Split(' '); //if (option.Length != 2) //{ // Log.Instance().WriteLog("参数错误:Action_Set_Role_Pro"+info.param); // return; //} String op = option[0]; switch (op) { case "level": //等级 { byte level = Convert.ToByte(option[2]); switch (option[1]) { case "+": { play.ChangeAttribute(UserAttribute.LEVEL, level); break; } case "-": { play.ChangeAttribute(UserAttribute.LEVEL, -level); break; } case "=": { play.GetBaseAttr().level = level; play.ChangeAttribute(UserAttribute.LEVEL, 0); break; } } break; } case "godlevel"://神等级 { byte godlevel = Convert.ToByte(option[2]); switch (option[1]) { case "+": { play.GetBaseAttr().godlevel += godlevel; break; } case "-": { play.GetBaseAttr().godlevel -= godlevel; break; } case "=": { play.GetBaseAttr().godlevel = godlevel; break; } } break; } case "hair": //发型 { play.ChangeAttribute(UserAttribute.HAIR, Convert.ToInt32(option[1])); break; } case "gold": //金币 { int nGold = Convert.ToInt32(option[2]); switch (option[1]) { case "+": { play.ChangeAttribute(UserAttribute.GOLD, nGold); break; } case "-": { play.ChangeAttribute(UserAttribute.GOLD, -nGold); break; } case "=": { play.GetBaseAttr().gold = nGold; play.ChangeAttribute(UserAttribute.GOLD, 0); break; } } break; } case "gamegold": //魔石 { int nGameGold = Convert.ToInt32(option[2]); switch (option[1]) { case "+": { play.ChangeAttribute(UserAttribute.GAMEGOLD, nGameGold); break; } case "-": { play.ChangeAttribute(UserAttribute.GAMEGOLD, -nGameGold); break; } case "=": { play.GetBaseAttr().gamegold = nGameGold; play.ChangeAttribute(UserAttribute.GAMEGOLD, 0); break; } } break; } case "job": //职业 { byte bJob = Convert.ToByte(option[2]); break; } case "pk": { switch (option[1]) { case "=": { play.GetBaseAttr().pk = Convert.ToInt16(option[2]); break; } case "+": { play.GetBaseAttr().pk += Convert.ToInt16(option[2]); break; } case "-": { play.GetBaseAttr().pk -= Convert.ToInt16(option[2]); break; } } play.ChangeAttribute(UserAttribute.PK, 0, false); break; } case "maxeudemon": { switch (option[1]) { case "=": { play.GetBaseAttr().maxeudemon = Convert.ToByte(option[2]); break; } case "+": { play.GetBaseAttr().maxeudemon += Convert.ToByte(option[2]); break; } case "-": { play.GetBaseAttr().maxeudemon -= Convert.ToByte(option[2]); break; } } play.ChangeAttribute(UserAttribute.MAXEUDEMON, 0,false); break; } } }
//玩家与玩家pk private static uint AdjustDamage(PlayerObject attack, PlayerObject def, bool isMagicAck = false/*是否是魔法伤害*/) { int attack_soul = attack.GetFightSoul(); int def_soul = def.GetFightSoul(); int dif = attack_soul - def_soul; int nSoulAddAtk = 0; int nSoulAddDef = 0; if(dif > 0) { //一点战斗力+一百点伤害 nSoulAddAtk = dif * 100; }else { //一点战斗力 +一百点防御 nSoulAddDef = Math.Abs(dif) * 100; } int nMaxRand = 50 + attack.GetLuck(); int nAtk = 0; if (IRandom.Random(0, 100) < nMaxRand) { if (isMagicAck && attack.GetBaseAttr().profession == JOB.MAGE) { nAtk = attack.GetMinAck() + IRandom.Random(0, attack.GetMaxMagixAck() - attack.GetMagicAck()) ; } else { nAtk = attack.GetMaxAck() + IRandom.Random(0, attack.GetMaxAck() - attack.GetMinAck()) ; } } else { if (isMagicAck && attack.GetBaseAttr().profession == JOB.MAGE) { nAtk = attack.GetMinAck() + IRandom.Random(0, attack.GetMagicAck() - attack.GetMagicAck()) ; } else { nAtk = attack.GetMinAck() + IRandom.Random(0, attack.GetMaxAck() - attack.GetMinAck()) ; } } nAtk += nSoulAddAtk; int nDef = 0; if (isMagicAck) { nDef = def.GetMagicDefense(); } else { nDef = def.GetDefense(); } nDef += nSoulAddDef; int nDamage = nAtk - nDef; if (attack.type == OBJECTTYPE.PLAYER) { nDamage += attack.GetLevel() / 10; } if (nDamage <= 0) { nDamage = IRandom.Random(1, 100) >= 50 ? 1 : 0; if (!isMagicAck) nDamage = 1; } return (uint)nDamage; }
private bool Action_TimeOut_Check(ActionInfo info, PlayerObject play) { int time_id = Convert.ToInt32(info.param); return ScriptTimerManager.Instance().CheckPlayerTimeOut(time_id, play.GetBaseAttr().player_id); }
//可以同步玩家各种属性信息- 目前只拿来同步血量 信息 public void ShareInfo(PlayerObject obj) { for (int i = 0; i < mlistMember.Count; i++) { PlayerObject play = mlistMember[i]; if (play.GetBaseAttr().player_id == obj.GetBaseAttr().player_id) continue; //不发给自己 NetMsg.MsgUserAttribute msg = new NetMsg.MsgUserAttribute(); msg.Create(null, play.GetGamePackKeyEx()); msg.role_id = play.GetTypeId(); msg.AddAttribute(GameStruct.UserAttribute.LIFE,obj.GetBaseAttr().life); msg.AddAttribute(GameStruct.UserAttribute.LIFE_MAX, obj.GetBaseAttr().life_max); play.SendData(msg.GetBuffer()); } }
private bool Action_TimeOut_Create(ActionInfo info, PlayerObject play) { String[] option = info.param.Split(' '); int time_id = Convert.ToInt32(option[0]); int time = Convert.ToInt32(option[1]); uint callback_id = Convert.ToUInt32(option[2]); return ScriptTimerManager.Instance().AddPlayerTimeOut(time_id, play.GetBaseAttr().player_id, time, callback_id); }
public void AddCachePlay(PlayerObject play) { for (int i = 0; i < mListCacheRole.Count; i++) { if (mListCacheRole[i].GetBaseAttr().sAccount == play.GetBaseAttr().sAccount) { mListCacheRole.RemoveAt(i); break; } } mListCacheRole.Add(play); }
private void Action_TimeOut_Delete(ActionInfo info, PlayerObject play) { int time_id = Convert.ToInt32(info.param); ScriptTimerManager.Instance().DeletePlayerTimeOut(time_id, play.GetBaseAttr().player_id); }
//军团添加成员 public void AddMember(uint legion_id,PlayerObject play) { //已经有军团了 if(play.GetLegionSystem().IsHaveLegion())return; Legion legion = GetLegion(legion_id); if (legion == null) return; LegionMember member = new LegionMember(); member.members_name = play.GetName(); member.money = 0; member.rank = GameBase.Config.Define.LEGION_PLACE_PUTONGTUANYUAN; legion.GetBaseInfo().list_member.Add(member); play.GetLegionSystem().SetLegion(legion,true); UpdateLegionInfo(legion_id, play.GetBaseAttr().player_id); }
//取当前玩家爵位等级 public GameStruct.GUANGJUELEVEL GetLevel(PlayerObject play) { GameStruct.GUANGJUELEVEL level = GameStruct.GUANGJUELEVEL.NORMAL; int pos = -1; for (int i = 0; i < mList.Count; i++) { if (mList[i].id == (uint)play.GetBaseAttr().player_id) { pos = i; break; } } if (pos != -1) { //1-3名- 王- 女王 if (pos >= 0 && pos <= 2) { level = play.GetSex() == Sex.MAN ? GameStruct.GUANGJUELEVEL.KING : GameStruct.GUANGJUELEVEL.QUEEN; } //公爵 4-15名 else if (pos >= 3 && pos <= 14) { level = GameStruct.GUANGJUELEVEL.DUKE; } //侯爵 16-50名 else if (pos >= 15 && pos <= 49) { level = GameStruct.GUANGJUELEVEL.MARQUIS; } return level; } ulong guanjue = play.GetBaseAttr().guanjue; //伯爵 大于2亿 if (guanjue >= 200000000) { level = GameStruct.GUANGJUELEVEL.EARL; } //子爵 大于1亿 else if (guanjue >= 100000000) { level = GameStruct.GUANGJUELEVEL.VISCOUNT; } //勋爵 大于30000000 else if (guanjue >= 30000000) { level = GameStruct.GUANGJUELEVEL.LORD; } return level; }