public void AddMonster_PVP(Variant p) { this.init(); bool loading = GRMap.loading; if (loading) { this.cacheProxy.Add(p); } else { uint @uint = p["iid"]._uint; uint num = 0u; int num2 = p["carr"]; bool flag = p.ContainsKey("cid"); if (flag) { num = p["cid"]._uint; } string name = p["name"]; Vector3 vector = new Vector3(p["x"] / 53.333f, 0f, p["y"] / 53.333f); MonsterPlayer monsterPlayer = null; bool flag2 = 2 == num2; if (flag2) { monsterPlayer = new ohterP2Warrior(); (monsterPlayer as ohterP2Warrior).Init(name, EnumLayer.LM_OTHERPLAYER, vector, false); } else { bool flag3 = 3 == num2; if (flag3) { monsterPlayer = new ohterP3Mage(); (monsterPlayer as ohterP3Mage).Init(name, EnumLayer.LM_OTHERPLAYER, vector, false); } else { bool flag4 = 5 == num2; if (flag4) { monsterPlayer = new ohterP5Assassin(); (monsterPlayer as ohterP5Assassin).Init(name, EnumLayer.LM_OTHERPLAYER, vector, false); } } } monsterPlayer.m_curModel.position = vector; bool flag5 = p.ContainsKey("face"); if (flag5) { monsterPlayer.m_curModel.rotation = new Quaternion(monsterPlayer.m_curModel.rotation.x, p["face"], monsterPlayer.m_curModel.rotation.z, 0f); } bool flag6 = monsterPlayer == null; if (!flag6) { monsterPlayer.setPos(vector); monsterPlayer.SetDestPos(vector); monsterPlayer.m_unIID = @uint; monsterPlayer.m_unCID = num; monsterPlayer.m_unPK_Param = num; monsterPlayer.maxHp = p["battleAttrs"]["max_hp"]; monsterPlayer.curhp = p["hp"]; bool flag7 = p.ContainsKey("zhuan"); if (flag7) { monsterPlayer.zhuan = p["zhuan"]; } bool flag8 = p.ContainsKey("pk_state"); if (flag8) { monsterPlayer.Pk_state = p["pk_state"]; } switch (monsterPlayer.Pk_state) { case 0: monsterPlayer.m_ePK_Type = PK_TYPE.PK_PEACE; break; case 1: monsterPlayer.m_ePK_Type = PK_TYPE.PK_PKALL; break; case 2: monsterPlayer.m_ePK_Type = PK_TYPE.PK_TEAM; break; case 3: monsterPlayer.m_ePK_Type = PK_TYPE.PK_LEGION; break; case 4: monsterPlayer.m_ePK_Type = PK_TYPE.PK_PEACE; break; } bool flag9 = p.ContainsKey("teamid"); if (flag9) { monsterPlayer.m_unTeamID = p["teamid"]; } bool flag10 = p.ContainsKey("clanid"); if (flag10) { monsterPlayer.m_unLegionID = p["clanid"]; } monsterPlayer.creatPetAvatar(num2); monsterPlayer.roleName = p["name"]; bool flag11 = !GRMap.loading; if (flag11) { monsterPlayer.refreshViewType(1); } bool flag12 = @uint > 0u; if (flag12) { monsterPlayer.m_unIID = @uint; this.m_mapMonster.Add(@uint, monsterPlayer); } else { monsterPlayer.isfake = true; monsterPlayer.m_unIID = this.idIdx; this.m_mapFakeMonster.Add(this.idIdx, monsterPlayer); this.idIdx += 1u; } monsterPlayer.refreshViewData1(p); } } }
public void AddMonster_PVP(Variant p) { init(); if (GRMap.grmap_loading) { cacheProxy.Add(p); return; } uint iid = p["iid"]._uint; uint cid = 0; int type = p["carr"]; if (p.ContainsKey("cid")) { cid = p["cid"]._uint; } string name = p["name"]; Vector3 born_pt = new Vector3(p["x"] / GameConstant.PIXEL_TRANS_UNITYPOS, 0f, p["y"] / GameConstant.PIXEL_TRANS_UNITYPOS); MonsterPlayer pro_role = null; //Type TCls = null; if (2 == type) { pro_role = new ohterP2Warrior(); } else if (3 == type) { pro_role = new ohterP3Mage(); } else if (5 == type) { pro_role = new ohterP5Assassin(); } if (iid > 0) { pro_role.m_unIID = iid; m_mapMonster.Add(iid, pro_role); } else { pro_role.isfake = true; pro_role.m_unIID = idIdx; m_mapFakeMonster.Add(idIdx, pro_role); idIdx++; } if (2 == type) { (pro_role as ohterP2Warrior).Init(name, EnumLayer.LM_OTHERPLAYER, born_pt); //TCls = System.Type.GetType("M000P2"); } else if (3 == type) { (pro_role as ohterP3Mage).Init(name, EnumLayer.LM_OTHERPLAYER, born_pt); //TCls = System.Type.GetType("M000P3"); } else if (5 == type) { (pro_role as ohterP5Assassin).Init(name, EnumLayer.LM_OTHERPLAYER, born_pt); //System.Type.GetType("M000P5"); } //if (TCls == null) //{ // TCls = System.Type.GetType("M00000"); //} //pro_role = (MonsterPlayer)Activator.CreateInstance(TCls); pro_role.m_curModel.position = born_pt; if (p.ContainsKey("face")) { pro_role.m_curModel.rotation = new Quaternion(pro_role.m_curModel.rotation.x, p["face"], pro_role.m_curModel.rotation.z, 0); } if (pro_role == null) { return; } // m_mapOtherPlayer.Add(iid, pro_role); pro_role.setPos(born_pt); pro_role.SetDestPos(born_pt); pro_role.m_unIID = iid; pro_role.m_unCID = cid; pro_role.m_unPK_Param = cid; pro_role.maxHp = p["battleAttrs"]["max_hp"]; pro_role.curhp = p["hp"]; if (p.ContainsKey("zhuan")) { pro_role.zhuan = p["zhuan"]; } if (p.ContainsKey("pk_state")) { pro_role.Pk_state = p["pk_state"]; } switch (pro_role.Pk_state) { case 0: pro_role.m_ePK_Type = PK_TYPE.PK_PEACE; break; case 1: pro_role.m_ePK_Type = PK_TYPE.PK_PKALL; break; case 2: pro_role.m_ePK_Type = PK_TYPE.PK_TEAM; break; case 3: pro_role.m_ePK_Type = PK_TYPE.PK_LEGION; break; case 4: pro_role.m_ePK_Type = PK_TYPE.PK_PEACE; break; } ; if (p.ContainsKey("teamid")) { pro_role.m_unTeamID = p["teamid"]; } if (p.ContainsKey("clanid")) { pro_role.m_unLegionID = p["clanid"]; } //if (p.ContainsKey("pet")) //{ // pro_role.ChangePetAvatar(p["pet"]["id"], p["pet"]["stage"]); //} pro_role.creatPetAvatar(type); pro_role.roleName = p["name"]; //if (GRMap.grmap_loading == false) // pro_role.refreshViewType(1); //if (Globle.isHardDemo) // TCls = getTypeHandle("Md" + tempid); //else //{ // if (isCollect) // { // TCls = System.Type.GetType("CollectRole"); // } // else // { // TCls = System.Type.GetType("M" + tempid); // } //} //if (id == 4002 || carr == 2) TCls = System.Type.GetType("M000P2"); //else if (id == 4003 || carr == 3) TCls = System.Type.GetType("M000P3"); //else if (id == 4005 || carr == 5) TCls = System.Type.GetType("M000P5"); //Type TCls; //if (Globle.isHardDemo) // TCls = getTypeHandle("Md" + iid); //else //{ // TCls = System.Type.GetType("M" + iid); //} //if (TCls == null) //{ // TCls = System.Type.GetType("M00000"); //} //pro_role = (MonsterPlayer)Activator.CreateInstance(TCls); pro_role.refreshViewData1(p); }