public float GetTraceRange(int mid) { bool flag = this.dMon.ContainsKey(mid); float result; if (flag) { SXML expr_1D = this.dMon[mid]; float?arg_59_0; if (expr_1D == null) { arg_59_0 = null; } else { SXML expr_3B = expr_1D.GetNode("ai", ""); arg_59_0 = ((expr_3B != null) ? new float?(expr_3B.getFloat("tracerang")) : null); } result = (arg_59_0 ?? 0f) / 53.333f; } else { result = 0f; } return(result); }
public MonsterRole AddMonster(int id, Vector3 pos, uint serverid = 0u, float roatate = 0f, int boset_num = 0, int carr = 0, string name = null) { this.init(); bool flag = this.m_mapMonster.ContainsKey(serverid); MonsterRole result; if (flag) { result = null; } else { SXML sXML = this.dMon[id]; int num = sXML.getInt("obj"); float @float = sXML.getFloat("scale"); bool flag2 = serverid <= 0u; if (flag2) { bool flag3 = Globle.m_nTestMonsterID > 0; if (flag3) { num = Globle.m_nTestMonsterID; } } bool flag4 = sXML.getInt("collect_tar") > 0; bool isHardDemo = Globle.isHardDemo; Type type; if (isHardDemo) { type = MonsterMgr.getTypeHandle("Md" + num); } else { bool flag5 = flag4; if (flag5) { bool flag6 = num == 122; if (flag6) { type = Type.GetType("CollectBox"); } else { type = Type.GetType("CollectRole"); } } else { type = Type.GetType("M" + num); } } bool flag7 = id == 4002 || carr == 2; if (flag7) { type = Type.GetType("M000P2"); } else { bool flag8 = id == 4003 || carr == 3; if (flag8) { type = Type.GetType("M000P3"); } else { bool flag9 = id == 4005 || carr == 5; if (flag9) { type = Type.GetType("M000P5"); } } } bool flag10 = type == null; if (flag10) { type = Type.GetType("M00000"); } MonsterRole monsterRole = (MonsterRole)Activator.CreateInstance(type); bool flag11 = name != null; if (flag11) { monsterRole.ownerName = name; } bool flag12 = carr == 0; if (flag12) { monsterRole.roleName = sXML.getString("name"); } monsterRole.tempXMl = sXML; monsterRole.m_circle_type = sXML.getInt("boss_circle"); bool flag13 = sXML.getFloat("boss_circle_scale") == -1f; if (flag13) { monsterRole.m_circle_scale = 1f; } else { monsterRole.m_circle_scale = sXML.getFloat("boss_circle_scale"); } monsterRole.isBoos = (sXML.getInt("boss") == 1); bool flag14 = @float > 0f; if (flag14) { monsterRole.scale = @float; } bool flag15 = monsterRole != null; if (flag15) { bool flag16 = id == 4002 || carr == 2; if (flag16) { monsterRole.Init("profession/warrior_inst", EnumLayer.LM_MONSTER, pos, roatate); } else { bool flag17 = id == 4003 || carr == 3; if (flag17) { monsterRole.Init("profession/mage_inst", EnumLayer.LM_MONSTER, pos, roatate); } else { bool flag18 = id == 4005 || carr == 5; if (flag18) { monsterRole.Init("profession/assa_inst", EnumLayer.LM_MONSTER, pos, roatate); } else { bool flag19 = flag4; if (flag19) { monsterRole.Init("npc/" + num, EnumLayer.LM_MONSTER, pos, roatate); } else { monsterRole.Init("monster/" + num, EnumLayer.LM_MONSTER, pos, roatate); } } } } monsterRole.monsterid = id; bool flag20 = boset_num > 0; if (flag20) { PlayerNameUIMgr.getInstance().show(monsterRole); PlayerNameUIMgr.getInstance().seticon_forDaobao(monsterRole, boset_num); } bool flag21 = ModelBase <A3_ActiveModel> .getInstance().mwlr_map_info.Count > 0; if (flag21) { PlayerNameUIMgr.getInstance().seticon_forMonsterHunter(monsterRole, ModelBase <A3_ActiveModel> .getInstance().mwlr_map_info[0]["target_mid"] != id); } bool flag22 = serverid > 0u; if (flag22) { monsterRole.m_unIID = serverid; this.m_mapMonster.Add(serverid, monsterRole); } else { monsterRole.isfake = true; monsterRole.m_unIID = this.idIdx; this.m_mapFakeMonster.Add(this.idIdx, monsterRole); this.idIdx += 1u; } bool flag23 = !GRMap.loading; if (flag23) { monsterRole.refreshViewType(2); } } this.m_listMonster.Add(monsterRole); bool flag24 = monsterRole != null; if (flag24) { base.dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, monsterRole, false)); } result = monsterRole; } return(result); }
public MonsterRole AddDartCar(Variant d) { this.init(); bool loading = GRMap.loading; MonsterRole result; if (loading) { this.cacheProxy.Add(d); result = null; } else { Vector3 pos = new Vector3(d["x"] / 53.333f, 0f, d["y"] / 53.333f); int num = d["mid"]; uint num2 = d["iid"]; bool flag = this.m_mapMonster.ContainsKey(num2); if (flag) { this.RemoveMonster(num2); } SXML sXML = this.dMon[num]; int num3 = sXML.getInt("obj"); float @float = sXML.getFloat("scale"); string empty = string.Empty; bool flag2 = num2 <= 0u; if (flag2) { bool flag3 = Globle.m_nTestMonsterID > 0; if (flag3) { num3 = Globle.m_nTestMonsterID; } } MDC000 mDC = new MDC000(); mDC.tempXMl = sXML; mDC.isBoos = (sXML.getInt("boss") == 1); bool flag4 = @float > 0f; if (flag4) { mDC.scale = @float; } bool flag5 = mDC != null; if (flag5) { mDC.Init("monster/" + num3, EnumLayer.LM_MONSTER, pos, 0f); mDC.curhp = d["hp"]; mDC.maxHp = d["battleAttrs"]["max_hp"]; mDC.escort_name = d["escort_name"]; PlayerNameUIMgr.getInstance().show(mDC); PlayerNameUIMgr.getInstance().setDartName(mDC, d["escort_name"] + "军团的镖车"); mDC.roleName = d["escort_name"] + "军团的镖车"; mDC.monsterid = num; bool flag6 = mDC.roleName == ModelBase <A3_LegionModel> .getInstance().myLegion.name; if (flag6) { mDC.m_isMarked = false; } bool flag7 = num2 > 0u; if (flag7) { mDC.m_unIID = num2; this.m_mapMonster.Add(num2, mDC); } else { mDC.isfake = true; mDC.m_unIID = this.idIdx; this.m_mapFakeMonster.Add(this.idIdx, mDC); this.idIdx += 1u; } bool flag8 = !GRMap.loading; if (flag8) { mDC.refreshViewType(2); } mDC.dartid = num; mDC.isDart = true; } this.m_listMonster.Add(mDC); bool flag9 = mDC != null; if (flag9) { base.dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, mDC, false)); } bool flag10 = d.ContainsKey("moving"); if (flag10) { uint @uint = d["iid"]._uint; MonsterRole monster = MonsterMgr._inst.getMonster(@uint); float float2 = d["moving"]["to_x"]._float; float float3 = d["moving"]["to_y"]._float; Vector3 sourcePosition = new Vector3(float2 * 32f / 53.333f, 0f, float3 * 32f / 53.333f); NavMeshHit navMeshHit; NavMesh.SamplePosition(sourcePosition, out navMeshHit, 100f, monster.m_layer); monster.SetDestPos(navMeshHit.position); } result = mDC; } return(result); }
public MonsterRole AddSummon(Variant m) { this.init(); bool loading = GRMap.loading; MonsterRole result; if (loading) { this.cacheProxy.Add(m); result = null; } else { Vector3 pos = new Vector3(m["x"] / 53.333f, 0f, m["y"] / 53.333f); int num = m["mid"]; uint num2 = m["iid"]; bool flag = this.m_mapMonster.ContainsKey(num2); if (flag) { this.RemoveMonster(num2); } SXML sXML = this.dMon[num]; int num3 = sXML.getInt("obj"); float @float = sXML.getFloat("scale"); string @string = sXML.getString("name"); bool flag2 = num2 <= 0u; if (flag2) { bool flag3 = Globle.m_nTestMonsterID > 0; if (flag3) { num3 = Globle.m_nTestMonsterID; } } MS0000 mS = new MS0000(); mS.tempXMl = sXML; mS.isBoos = (sXML.getInt("boss") == 1); bool flag4 = @float > 0f; if (flag4) { mS.scale = @float; } bool flag5 = mS != null; if (flag5) { mS.Init("monster/" + num3, EnumLayer.LM_MONSTER, pos, 0f); PlayerNameUIMgr.getInstance().show(mS); PlayerNameUIMgr.getInstance().setName(mS, @string, m["owner_name"] + "的小伙伴"); mS.roleName = @string; mS.monsterid = num; bool flag6 = num2 > 0u; if (flag6) { mS.m_unIID = num2; this.m_mapMonster.Add(num2, mS); } else { mS.isfake = true; mS.m_unIID = this.idIdx; this.m_mapFakeMonster.Add(this.idIdx, mS); this.idIdx += 1u; } bool flag7 = !GRMap.loading; if (flag7) { mS.refreshViewType(2); } mS.issummon = true; mS.summonid = num; mS.masterid = m["owner_cid"]; bool flag8 = mS.masterid == ModelBase <PlayerModel> .getInstance().cid; if (flag8) { bool flag9 = a3_herohead.instance; if (flag9) { ModelBase <A3_SummonModel> .getInstance().lastatkID = 0u; a3_herohead.instance.refresh_sumHp(m["hp"], m["battleAttrs"]["max_hp"]); a3_herohead.instance.refresh_sumbar(); a3_herohead.instance.do_sum_CD = false; } } } this.m_listMonster.Add(mS); bool flag10 = mS != null; if (flag10) { base.dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, mS, false)); } bool flag11 = mS != null; if (flag11) { mS.curhp = m["hp"]; mS.maxHp = m["battleAttrs"]["max_hp"]; mS.owner_cid = m["owner_cid"]; } result = mS; } return(result); }
public MonsterRole AddMonster(int id, Vector3 pos, uint serverid = 0, float roatate = 0, int boset_num = 0, int carr = 0, string name = null) { init(); if (m_mapMonster.ContainsKey(serverid)) { return(m_mapMonster[serverid]); } MonsterRole mon = null; //if (monID == 1) //{ SXML xml = dMon[id]; int tempid = xml.getInt("obj"); float scale = xml.getFloat("scale"); //用来给美术测试新加的怪物用的 if (serverid <= 0) { if (Globle.m_nTestMonsterID > 0) { tempid = Globle.m_nTestMonsterID; } } bool isCollect = xml.getInt("collect_tar") > 0; bool isboxCollect = xml.getInt("collect_box") > 0; // 判断这个宝箱是不是采集用的 > 0 则是采集的用宝箱 //Type TCls; //if (Globle.isHardDemo) // TCls = getTypeHandle("Md" + tempid); //else //{ // if (isCollect) // { // if (tempid == 122 && !isboxCollect) // { // TCls = System.Type.GetType("CollectBox"); // } // else 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"); //if (TCls == null) //{ // TCls = System.Type.GetType("M00000"); //} //mon = (MonsterRole)Activator.CreateInstance(TCls); if (isCollect) { if (tempid == 122) { mon = new CollectBox(); } else { mon = new CollectRole(); } } if (id == 4002 || carr == 2) { mon = new M000P2(); } else if (id == 4003 || carr == 3) { mon = new M000P3(); } else if (id == 4005 || carr == 5) { mon = new M000P5(); } if (mon == null) { mon = new M00000(); } if (name != null) { mon.ownerName = name; } if (carr == 0) { mon.roleName = xml.getString("name"); } mon.tempXMl = xml; mon.m_circle_type = xml.getInt("boss_circle"); if (xml.getFloat("boss_circle_scale") == -1) { mon.m_circle_scale = 1; } else { mon.m_circle_scale = xml.getFloat("boss_circle_scale"); } mon.isBoos = xml.getInt("boss") == 1; mon.isBoss_c = xml.getInt("boss_c") == 1; if (scale > 0f) { mon.scale = scale; } if (serverid > 0) { mon.m_unIID = serverid; m_mapMonster.Add(serverid, mon); } else { mon.isfake = true; mon.m_unIID = idIdx; m_mapFakeMonster.Add(idIdx, mon); idIdx++; } if (mon != null) { if (id == 4002 || carr == 2) { mon.Init("profession_warrior_inst", EnumLayer.LM_MONSTER, pos, roatate); } else if (id == 4003 || carr == 3) { mon.Init("profession_mage_inst", EnumLayer.LM_MONSTER, pos, roatate); } else if (id == 4005 || carr == 5) { mon.Init("profession_assa_inst", EnumLayer.LM_MONSTER, pos, roatate); } else if (isCollect) { mon.Init("npc_" + tempid, EnumLayer.LM_MONSTER, pos, roatate); } else { mon.Init("monster_" + tempid, EnumLayer.LM_MONSTER, pos, roatate); } mon.monsterid = id; if (boset_num > 0) { PlayerNameUIMgr.getInstance().show(mon); PlayerNameUIMgr.getInstance().seticon_forDaobao(mon, boset_num); } if (A3_ActiveModel.getInstance().mwlr_map_info.Count > 0) { PlayerNameUIMgr.getInstance().seticon_forMonsterHunter(mon, A3_ActiveModel.getInstance().mwlr_map_info[0]["target_mid"] != id); } //if (GRMap.grmap_loading == false) // mon.refreshViewType(2); } m_listMonster.Add(mon); //} //else if (monID == 2) //{ // mon = new M10002Srg(); // mon.Init("monster/10002", EnumLayer.LM_MONSTER, bornpt); // m_mapMonster.Add(idIdx, mon); //} //else if (monID == 3) //{ // mon = new M10003Stl(); // mon.Init("monster/10003", EnumLayer.LM_MONSTER, bornpt); // m_mapMonster.Add(idIdx, mon); //} //if (mon != null) //{ // MonsterData dta = new MonsterData(); // dta.roleId = idIdx; // dta.monid = monID; // mon.monsterDta = dta; //} //idIdx++; if (mon != null) { dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, mon)); } return(mon); }
public MonsterRole AddDartCar(Variant d)//镖车 { init(); if (GRMap.grmap_loading) { cacheProxy.Add(d); return(null); } Vector3 born_pt = new Vector3(d["x"] / GameConstant.PIXEL_TRANS_UNITYPOS, 0f, d["y"] / GameConstant.PIXEL_TRANS_UNITYPOS); int id = d["mid"]; uint serverid = d["iid"]; if (m_mapMonster.ContainsKey(serverid)) { return(m_mapMonster[serverid]); } SXML xml = dMon[id]; int tempid = xml.getInt("obj"); float scale = xml.getFloat("scale"); string name = string.Empty; if (serverid <= 0) { if (Globle.m_nTestMonsterID > 0) { tempid = Globle.m_nTestMonsterID; } } MDC000 mon = new MDC000(); mon.tempXMl = xml; mon.isBoos = xml.getInt("boss") == 1; mon.isBoss_c = xml.getInt("boss_c") == 1; if (scale > 0f) { mon.scale = scale; } if (mon != null) { if (serverid > 0) { mon.m_unIID = serverid; m_mapMonster.Add(serverid, mon);//这个地图上的所有的monster } else { mon.isfake = true; mon.m_unIID = idIdx; m_mapFakeMonster.Add(idIdx, mon); idIdx++; } mon.Init("monster_" + tempid, EnumLayer.LM_MONSTER, born_pt, 0); mon.curhp = d["hp"]; mon.maxHp = d["battleAttrs"]["max_hp"]; mon.escort_name = d["escort_name"]; PlayerNameUIMgr.getInstance().show(mon); PlayerNameUIMgr.getInstance().setDartName(mon, d["escort_name"] + ContMgr.getCont("MonsterMgr1")); mon.roleName = d["escort_name"] + ContMgr.getCont("MonsterMgr1"); mon.monsterid = id; if (mon.roleName == A3_LegionModel.getInstance().myLegion.name) { mon.m_isMarked = false; } //if (GRMap.grmap_loading == false) // mon.refreshViewType(2); mon.dartid = id; mon.isDart = true; } m_listMonster.Add(mon); if (mon != null) { dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, mon)); } if (d.ContainsKey("moving")) { uint iid = d["iid"]._uint; var vv = MonsterMgr._inst.getMonster(iid); float to_x = d["moving"]["to_x"]._float; float to_y = d["moving"]["to_y"]._float; NavMeshHit hit; Vector3 vec = new Vector3(to_x * 32 / GameConstant.PIXEL_TRANS_UNITYPOS, 0f, to_y * 32 / GameConstant.PIXEL_TRANS_UNITYPOS); NavMesh.SamplePosition(vec, out hit, 100f, vv.m_layer); vv.SetDestPos(hit.position); } return(mon); }
public MonsterRole AddSummon(Variant m) { init(); if (GRMap.grmap_loading) { cacheProxy.Add(m); return(null); } Vector3 born_pt = new Vector3(m["x"] / GameConstant.PIXEL_TRANS_UNITYPOS, 0f, m["y"] / GameConstant.PIXEL_TRANS_UNITYPOS); int id = m["mid"]; uint serverid = m["iid"]; if (m_mapMonster.ContainsKey(serverid)) { if (m["owner_cid"] == PlayerModel.getInstance().cid) { if (a3_herohead.instance) { A3_SummonModel.getInstance().lastatkID = 0; a3_herohead.instance.refresh_sumHp(m["hp"], m["battleAttrs"]["max_hp"]); a3_herohead.instance.refresh_sumbar(); a3_herohead.instance.do_sum_CD = false; } } return(m_mapMonster[serverid]); } //return null; SXML xml = dMon[id]; int tempid = xml.getInt("obj"); float scale = xml.getFloat("scale"); string name = xml.getString("name"); if (serverid <= 0) { if (Globle.m_nTestMonsterID > 0) { tempid = Globle.m_nTestMonsterID; } } MS0000 mon = new MS0000(); mon.tempXMl = xml; mon.isBoos = xml.getInt("boss") == 1; mon.isBoss_c = xml.getInt("boss_c") == 1; if (scale > 0f) { mon.scale = scale; } if (mon != null) { if (serverid > 0) { mon.m_unIID = serverid; m_mapMonster.Add(serverid, mon); roleSummonMapping[m["owner_cid"]] = serverid; // 人物对应的召唤兽 id } else { mon.isfake = true; mon.m_unIID = idIdx; m_mapFakeMonster.Add(idIdx, mon); idIdx++; } mon.masterid = m["owner_cid"]; mon.issummon = true; mon.summonid = id; if (SceneCamera.m_nModelDetail_Level != 1 && mon.masterid != PlayerModel.getInstance().cid) {//设置隐藏召唤兽 mon.Init("monster_" + tempid, EnumLayer.LM_DEFAULT, born_pt, 0); } else { mon.Init("monster_" + tempid, EnumLayer.LM_MONSTER, born_pt, 0); } mon.m_layer = EnumLayer.LM_MONSTER; PlayerNameUIMgr.getInstance().show(mon); PlayerNameUIMgr.getInstance().setName(mon, name, m["owner_name"] + ContMgr.getCont("MonsterMgr")); mon.roleName = name; mon.monsterid = id; //if (GRMap.grmap_loading == false) // mon.refreshViewType(2); //mon.master = RoleMgr._instance.getRole(m["owner_cid"]); if (mon.masterid == PlayerModel.getInstance().cid) { if (a3_herohead.instance) { A3_SummonModel.getInstance().lastatkID = 0; a3_herohead.instance.refresh_sumHp(m["hp"], m["battleAttrs"]["max_hp"]); a3_herohead.instance.refresh_sumbar(); a3_herohead.instance.do_sum_CD = false; } } } m_listMonster.Add(mon); if (mon != null) { dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_ADD, this, mon)); } if (mon != null) { mon.curhp = m["hp"]; mon.maxHp = m["battleAttrs"]["max_hp"]; mon.owner_cid = m["owner_cid"]; } return(mon); }