public void LoadServerObject(ByteBuffer buff) { ID = buff.ReadUInt32(); NPCID = buff.ReadUInt32(); Name = buff.ReadString(); if (Name.Length == 0) { Name = Util.GetNPCName(NPCID); } //buff.ReadUInt32(); //type isAttackable = buff.ReadUInt32(); X = buff.ReadInt32(); Y = buff.ReadInt32(); Z = buff.ReadInt32(); Heading = buff.ReadInt32(); CollisionRadius = (float)buff.ReadDouble(); CollisionHeight = (float)buff.ReadDouble(); //isInvisible = buff.ReadUInt32(); // buff.ReadUInt32(); // buff.ReadUInt32(); Cur_HP = buff.ReadUInt32(); Max_HP = buff.ReadUInt32(); Cur_MP = buff.ReadUInt32(); Max_MP = buff.ReadUInt32(); //buff.ReadUInt32(); //hpshown //buff.ReadUInt32(); //dmggrade //ID = buff.ReadUInt32(); //NPCID = buff.ReadUInt32(); //Name = buff.ReadString(); //if (Name.Length == 0) //{ //Name = Util.GetNPCName(NPCID); //} //isAttackable = buff.ReadUInt32(); //X = buff.ReadInt32(); //Y = buff.ReadInt32(); //Z = buff.ReadInt32(); //buff.ReadInt32(); //MoveSpeedMult = System.Convert.ToSingle(buff.ReadDouble()); //AttackSpeedMult = System.Convert.ToSingle(buff.ReadDouble()); //CollisionRadius = System.Convert.ToSingle(buff.ReadDouble()); //CollisionHeight = System.Convert.ToSingle(buff.ReadDouble()); //Cur_HP = buff.ReadUInt32(); //Max_HP = buff.ReadUInt32(); //buff.ReadInt32();//type //buff.ReadInt32(); Persist = true; }
private void UpdateNPCListInternal() { System.Collections.ArrayList dirty_items = new System.Collections.ArrayList(); for (int i = 0; i < listView_npc_data.Items.Count; i++) { uint id = Util.GetUInt32(((ListViewItem)listView_npc_data_items[i]).SubItems[2].Text); if (Globals.gamedata.nearby_npcs.ContainsKey(id)) { NPCInfo npc = Util.GetNPC(id); npc.InList = true; //update it //((ListViewItem)listView_npc_data_items[i]).SubItems[0].Text = Util.GetNPCName(npc.NPCID); //((ListViewItem)listView_npc_data_items[i]).SubItems[1].Text = npc.Title; //((ListViewItem)listView_npc_data_items[i]).SubItems[2].Text = npc.ID.ToString(); //((ListViewItem)listView_npc_data_items[i]).SubItems[3].Text = npc.NPCID.ToString(); } else { dirty_items.Add(i); } } //need to remove all dirty items now for (int i = dirty_items.Count - 1; i >= 0; i--) { listView_npc_data_items.RemoveAt((int)dirty_items[i]); } dirty_items.Clear(); foreach (NPCInfo npc in Globals.gamedata.nearby_npcs.Values) { if (!npc.InList) { npc.InList = true; if (npc.isInvisible != 1) { //add it System.Windows.Forms.ListViewItem ObjListItem; ObjListItem = new ListViewItem(Util.GetNPCName(npc.NPCID)); //Name ObjListItem.SubItems.Add(npc.Title); //Title ObjListItem.SubItems.Add(npc.ID.ToString()); //ObjID ObjListItem.SubItems.Add(npc.NPCID.ToString()); //TypeID listView_npc_data_items.Add(ObjListItem); } } } }
public void Load_Pet(ByteBuffer buff) { SummonType = buff.ReadUInt32(); //1 = summon, 2 = pet ID = buff.ReadUInt32(); NPCID = buff.ReadUInt32(); isAttackAble = buff.ReadUInt32();//attackable = 0 X = buff.ReadUInt32(); Y = buff.ReadUInt32(); Z = buff.ReadUInt32(); Heading = buff.ReadInt32(); buff.ReadUInt32();//0x00 MatkSpeed = buff.ReadUInt32(); PatkSpeed = buff.ReadUInt32(); RunSpeed = buff.ReadUInt32(); WalkSpeed = buff.ReadUInt32(); SwimRunSpeed = buff.ReadUInt32(); SwimWalkSpeed = buff.ReadUInt32(); flRunSpeed = buff.ReadUInt32(); flWalkSpeed = buff.ReadUInt32(); if (Globals.gamedata.Chron >= Chronicle.CT1) { FlyRunSpeed = buff.ReadUInt32(); FlyWalkSpeed = buff.ReadUInt32(); } MoveSpeedMult = System.Convert.ToSingle(buff.ReadDouble()); AttackSpeedMult = System.Convert.ToSingle(buff.ReadDouble()); CollisionRadius = System.Convert.ToSingle(buff.ReadDouble()); CollisionHeight = System.Convert.ToSingle(buff.ReadDouble()); LWeapon = buff.ReadUInt32(); Armor = buff.ReadUInt32(); RWeapon = buff.ReadUInt32(); HasOwner = buff.ReadByte(); //owneronline isRunning = buff.ReadByte(); isInCombat = buff.ReadByte(); isAlikeDead = buff.ReadByte(); isSummoned = buff.ReadByte(); //isSummoned 0=teleported 1=default 2=summoned if (Globals.gamedata.Chron >= Chronicle.CT3_0) { buff.ReadUInt32(); //FF FF FF FF } Name = buff.ReadString(); if (string.IsNullOrWhiteSpace(Name)) { Name = Util.GetNPCName(NPCID);//"Unnamed Pet"; } if (Globals.gamedata.Chron >= Chronicle.CT3_0) { buff.ReadUInt32(); //FF FF FF FF } Title = buff.ReadString(); //OwnerName buff.ReadUInt32(); //1 PvPFlag = buff.ReadUInt32(); Karma = buff.ReadInt32(); Cur_Fed = buff.ReadUInt32(); Max_Fed = buff.ReadUInt32(); Cur_HP = buff.ReadUInt32(); Max_HP = buff.ReadUInt32(); Cur_MP = buff.ReadUInt32(); Max_MP = buff.ReadUInt32(); SP = buff.ReadUInt32(); Level = buff.ReadUInt32(); XP = buff.ReadUInt64(); XP_ThisLevel = buff.ReadUInt64(); XP_NextLevel = buff.ReadUInt64(); Cur_Load = buff.ReadUInt32(); Max_Load = buff.ReadUInt32(); Patk = buff.ReadUInt32(); PDef = buff.ReadUInt32(); Accuracy = buff.ReadUInt32(); // p Evasion = buff.ReadUInt32(); //p Focus = buff.ReadUInt32(); //p Matk = buff.ReadUInt32(); MDef = buff.ReadUInt32(); buff.ReadUInt32(); //m acu buff.ReadUInt32(); //m eva buff.ReadUInt32(); //m crit buff.ReadUInt32(); // speed buff.ReadUInt32(); //patak sped buff.ReadUInt32(); // cast /*if (Globals.gamedata.Chron < Chronicle.CT3_0) * { * AbnormalEffects = buff.ReadUInt32(); //AbnormalEffect bleed=1; poison=2; poison & bleed=3; flame=4; * } * else * { * buff.ReadUInt32(); //?? * }*/ Mountable = buff.ReadUInt16(); buff.ReadByte(); buff.ReadUInt16(); if (Globals.gamedata.Chron >= Chronicle.CT1) { TeamCircle = buff.ReadByte(); /*if (Globals.gamedata.Chron >= Chronicle.CT3_0) * { * //buff.ReadUInt32(); //00 00 00 00 * buff.ReadUInt16(); * AbnormalEffects = buff.ReadUInt32(); * buff.ReadUInt32(); //00 00 00 00 * buff.ReadUInt16(); //00 00 00 00 * }*/ SSUsage = buff.ReadUInt32(); SPSUSage = buff.ReadUInt32(); Form = buff.ReadUInt32(); buff.ReadUInt32();//0x00 if (Globals.gamedata.Chron >= Chronicle.CT3_0) { //buff.ReadUInt16(); //00 00 try { buff.ReadUInt32(); //00 00 buff.ReadUInt32(); //02 00 00 00 current pet points buff.ReadUInt32(); //06 00 00 00 max pet points uint abn_count = buff.ReadUInt32(); if (abn_count < 30) // well ... its oddi wayso :P { _AbnEffects.Add(buff.ReadUInt32()); } } catch { } } } else { HasOwner = buff.ReadByte(); SSUsage = buff.ReadUInt32(); Form = buff.ReadUInt32(); buff.ReadUInt32();//0x00 } }
public void LoadStaticObject(ByteBuffer buff) { /*9F * AE C1 06 01 //id * 6D 01 10 58 //npcid * * 01 00 00 00 //type * 01 00 00 00 //targetable * 01 00 00 00 //meshindex * 01 00 00 00 //closed * 00 00 00 00 //enemy * * D8 E1 90 00 //currhp * D8 E1 90 00 //maxhp * 00 00 00 00 //hpshown * 00 00 00 00 //dmgGrade */ /* * writeC(0x9F); * writeD(_staticObjectId); * writeD(_objectId); * writeD(_type); * writeD(_targetable); * writeD(_meshIndex); * writeD(_closed); * writeD(_enemy); * writeD(_currentHp); * writeD(_maxHp); * writeD(_hpShown); * writeD(_damageGrade);*/ ID = buff.ReadUInt32(); NPCID = buff.ReadUInt32(); Name = Util.GetNPCName(NPCID); buff.ReadUInt32(); //type isAttackable = buff.ReadUInt32(); isInvisible = buff.ReadUInt32(); buff.ReadUInt32(); buff.ReadUInt32(); Cur_HP = buff.ReadUInt32(); Max_HP = buff.ReadUInt32(); buff.ReadUInt32(); //hpshown buff.ReadUInt32(); //dmggrade //ID = buff.ReadUInt32(); //NPCID = buff.ReadUInt32(); //Name = buff.ReadString(); //if (Name.Length == 0) //{ // Name = Util.GetNPCName(NPCID); //} //isAttackable = buff.ReadUInt32(); //X = buff.ReadInt32(); //Y = buff.ReadInt32(); //Z = buff.ReadInt32(); //buff.ReadInt32();//heading //MoveSpeedMult = System.Convert.ToSingle(buff.ReadDouble()); //AttackSpeedMult = System.Convert.ToSingle(buff.ReadDouble()); //CollisionRadius = System.Convert.ToSingle(buff.ReadDouble()); //CollisionHeight = System.Convert.ToSingle(buff.ReadDouble()); //Cur_HP = buff.ReadUInt32(); //Max_HP = buff.ReadUInt32(); //buff.ReadInt32();//type //buff.ReadInt32(); Persist = true; }
public void Load(ByteBuffer buff) { //ct2.2: 0C D5 5B 30 4F A6 95 0F 00 01 00 00 00 86 F2 01 00 54 68 FF FF 30 F2 FF FF 00 00 00 00 00 00 00 00 4D 01 00 00 16 01 00 00 AF 00 00 00 2C 00 00 00 AF 00 00 00 2C 00 00 00 AF 00 00 00 2C 00 00 00 AF 00 00 00 2C 00 00 00 9A 99 99 99 99 99 F1 3F 81 43 A8 52 B3 07 F0 3F 00 00 00 00 00 00 30 40 00 00 00 00 00 00 43 40 C8 09 00 00 00 00 00 00 06 1B 00 00 01 01 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 40 00 00 00 00 00 00 43 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 //int offset = 1; //13 March 2013 //packet parser: cddddddddddddddddddffffdddcccccdhdsddddddddccffddddccddddddddchcdhchd(d) ID = buff.ReadUInt32(); NPCID = buff.ReadUInt32(); isAttackable = buff.ReadUInt32(); X = buff.ReadInt32(); Y = buff.ReadInt32(); Z = buff.ReadInt32(); Dest_X = X; Dest_Y = Y; Dest_Z = Z; Heading = buff.ReadInt32(); buff.ReadUInt32(); MatkSpeed = buff.ReadUInt32(); PatkSpeed = buff.ReadUInt32(); RunSpeed = buff.ReadUInt32(); WalkSpeed = buff.ReadUInt32(); SwimRunSpeed = buff.ReadUInt32(); SwimWalkSpeed = buff.ReadUInt32(); flRunSpeed = buff.ReadUInt32(); flWalkSpeed = buff.ReadUInt32(); FlyRunSpeed = buff.ReadUInt32(); FlyWalkSpeed = buff.ReadUInt32(); MoveSpeedMult = System.Convert.ToSingle(buff.ReadDouble()); AttackSpeedMult = System.Convert.ToSingle(buff.ReadDouble()); CollisionRadius = System.Convert.ToSingle(buff.ReadDouble()); CollisionHeight = System.Convert.ToSingle(buff.ReadDouble()); RHand = buff.ReadUInt32(); LRHand = buff.ReadUInt32(); LHand = buff.ReadUInt32(); NameShows = buff.ReadByte(); isRunning = buff.ReadByte(); isInCombat = buff.ReadByte(); isAlikeDead = buff.ReadByte(); buff.ReadByte(); isInvisible = 0; buff.ReadUInt32(); //FF FF FF FF Name = buff.ReadString(); //00 00 buff.ReadUInt32(); //FF FF FF FF /* * Name = buff.ReadString();//Name * if (Name.Length == 0) * { * Name = Util.GetNPCName(NPCID); * } * * buff.ReadUInt32(); //FF FF FF FF */ if (Name.Length == 0) { Name = Util.GetNPCName(NPCID); } Title = buff.ReadString(); //try and get the title for npcs (mobs, not summons) if (Title.Length == 0) { Title = Util.GetNPCTitle(NPCID); } //if that failed, we get the NPC's master's title... mobs get their name as their title, o well if (Title.Length == 0) { Title = Name; } //Globals.l2net_home.Add_Text("nametemp: " + nametemp + "Name: " + Name + "Title: " + Title, Globals.Red, TextType.ALL); //GD OK SummonedNameColor = buff.ReadUInt32();//0 = normal, 1 = summoned name color PvPFlag = buff.ReadUInt32(); Karma = buff.ReadInt32(); AbnormalEffects = buff.ReadUInt32(); buff.ReadUInt32(); //clan ID?? buff.ReadUInt32(); //crest ID?? buff.ReadUInt32(); //clan ID buff.ReadUInt32(); //crest ID buff.ReadByte(); //isflying TeamCircle = buff.ReadByte(); buff.ReadDouble(); // col height buff.ReadDouble(); // col rad buff.ReadUInt32(); // 00 00 00 00 buff.ReadUInt32(); // 00 00 00 00 buff.ReadInt32(); // 00 00 00 00 buff.ReadInt32(); // 00 00 00 00 // buff.ReadInt32(); // 00 00 00 00 isTargetable = buff.ReadByte(); // 01 showName = buff.ReadByte(); // 01 if (isTargetable == 0 || showName == 0) { GameData.badmobs_ignored += 1; } ExtendedEffects = buff.ReadUInt32(); // 00 00 00 00 buff.ReadInt32(); // roacknow buff.ReadInt32(); // rock now - cur hp buff.ReadInt32(); // rock now - max hp buff.ReadInt32(); // rock now - cur mp buff.ReadInt32(); // rock now - max m buff.ReadInt32(); // rock now - cur cp buff.ReadInt32(); // rock now - max cp buff.ReadByte(); //00 buff.ReadInt16(); //00 00 buff.ReadByte(); buff.ReadInt32(); buff.ReadInt16(); buff.ReadByte(); buff.ReadInt16(); int abn_count = buff.ReadInt32(); if (abn_count >= 30) { #if DEBUG Globals.l2net_home.Add_Text("More than 30 abnormal effects, probably an error... Count: " + abn_count, Globals.Yellow, TextType.BOT); #endif abn_count = 10; } //Globals.l2net_home.Add_Text("count " + abn_count, Globals.Yellow, TextType.BOT); AbnEffects.Clear(); for (uint i = 0; i < (uint)abn_count; i++) { uint tmpabneff = buff.ReadUInt32(); //Globals.l2net_home.Add_Text("Adding abnormal vfx to npc : " + tmpabneff.ToString("X2") + " to : " + Name, Globals.Yellow, TextType.BOT); AbnEffects.Add(tmpabneff); } }
public void LoadEX(ByteBuffer buff) { /*FE * 66 01 * * 03 46 10 48 //id * * 00 25 00 ED //NPCID? * * BE 4E A2 0C * 07 00 00 00 * 00 00 00 00 * 38 00 40 C6 * 0F 00 * * B0 43 00 00 //x * 80 97 02 00 //y * 58 F2 FF FF //z * 24 3F 00 00 8E 01 00 00 2B 01 00 00 00 00 80 3F 97 08 8A 3F 01 01 00 00 00 00 00 00 00 00 00 14 39 00 00 14 39 00 00 0C 00 00 */ /* ----------------------------------------------------- * --- from adifenix :P * FE 66 01 * D8 F1 A0 4E id * 00 // 1 - update (smal pck) or animaion.. / 0 - normal pck * 25 00 //? * ED BE 4E A2 //? * 0C //? * 07 01 00 00 //? * 00 00 00 00 //? * 38 00 //? * 2C 9C 0F 00 typeid * 7C D5 FE FF x * DF 72 02 00 y * 48 F3 FF FF z * AD 54 00 00 // cast ata sped ? * 4E 01 00 00 //atta sped ? * 17 01 00 00 // ..? * 00 00 //? * 80 3F // max? * 24 97 // cur? * 80 3F // max ? * 01 00 // cur? * 00 00 00 00 //? * 00 00 00 00 //? * 00 //?? * 41 02 00 00 -- if im not wrong ... if u chnage the last 02(in alot of cases there is 0c) to 00 then u cant see title (naughty boys and girls at ti :P) * after some tests .. * it look like now alot of thngs deppends on l2 files .. ex showing hp bar * i tested it using same packed (guard of city) and just changed the typeid to mob one and hp bar apeared .. * ------------------------------------------------ * // thats how i would parse it */ ID = buff.ReadUInt32(); int update = buff.ReadByte(); if (update == 0) // aka normal "fresh" data { buff.ReadInt16(); buff.ReadInt32(); buff.ReadByte(); buff.ReadInt32(); buff.ReadInt32(); buff.ReadInt16(); NPCID = buff.ReadUInt32(); Name = Util.GetNPCName(NPCID); Title = Util.GetNPCTitle(NPCID); X = buff.ReadInt32(); Y = buff.ReadInt32(); Z = buff.ReadInt32(); Dest_X = X; Dest_Y = Y; Dest_Z = Z; buff.ReadUInt32(); //?? buff.ReadUInt32(); //8E 01 00 00 buff.ReadUInt32(); //2B 01 00 00 buff.ReadUInt16(); //00 00 buff.ReadUInt32(); //80 3F 97 08 buff.ReadUInt16(); //8A 3F buff.ReadByte(); //01 buff.ReadByte(); //01 buff.ReadByte(); //00 buff.ReadUInt32(); //00 00 00 00 buff.ReadUInt32(); //00 00 00 00 Cur_HP = buff.ReadUInt32(); //14 39 00 00 Max_HP = buff.ReadUInt32(); //14 39 00 00 NameShows = buff.ReadByte(); // if 0 = hide name .. buff.ReadByte(); //00 buff.ReadByte(); //00 } }
public static string TARGET_STRING(string req) { switch (Globals.gamedata.my_char.CurrentTargetType) { case TargetType.ERROR: case TargetType.NONE: break; case TargetType.SELF: switch (req) { case "NAME": return(Globals.gamedata.my_char.Name); case "TITLE": return(Globals.gamedata.my_char.Title); case "CLAN": return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).ClanName); case "ALLY": return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).AllyName); default: ScriptEngine.Script_Error("invalid invalid target data(self) request"); break; } break; case TargetType.MYPET: switch (req) { case "NAME": return(Globals.gamedata.my_pet.Name); case "TITLE": return(Globals.gamedata.my_pet.Title); case "CLAN": return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).ClanName); case "ALLY": return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).AllyName); default: ScriptEngine.Script_Error("invalid invalid target data(my pet) request"); break; } break; case TargetType.MYPET1: switch (req) { case "NAME": return(Globals.gamedata.my_pet1.Name); case "TITLE": return(Globals.gamedata.my_pet1.Title); case "CLAN": return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).ClanName); case "ALLY": return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).AllyName); default: ScriptEngine.Script_Error("invalid invalid target data(my pet) request"); break; } break; case TargetType.MYPET2: switch (req) { case "NAME": return(Globals.gamedata.my_pet2.Name); case "TITLE": return(Globals.gamedata.my_pet2.Title); case "CLAN": return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).ClanName); case "ALLY": return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).AllyName); default: ScriptEngine.Script_Error("invalid invalid target data(my pet) request"); break; } break; case TargetType.MYPET3: switch (req) { case "NAME": return(Globals.gamedata.my_pet3.Name); case "TITLE": return(Globals.gamedata.my_pet3.Title); case "CLAN": return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).ClanName); case "ALLY": return(((Clan_Info)Globals.clanlist[Globals.gamedata.my_char.ClanID]).AllyName); default: ScriptEngine.Script_Error("invalid invalid target data(my pet) request"); break; } break; case TargetType.PLAYER: Globals.PlayerLock.EnterReadLock(); try { CharInfo player = Util.GetChar(Globals.gamedata.my_char.TargetID); if (player != null) { switch (req) { case "NAME": return(player.Name); case "TITLE": return(player.Title); case "CLAN": return(((Clan_Info)Globals.clanlist[player.ClanID]).ClanName); case "ALLY": return(((Clan_Info)Globals.clanlist[player.ClanID]).AllyName); default: ScriptEngine.Script_Error("invalid invalid target data(player) request"); break; } } } //unlock finally { Globals.PlayerLock.ExitReadLock(); } break; case TargetType.NPC: Globals.NPCLock.EnterReadLock(); try { NPCInfo npc = Util.GetNPC(Globals.gamedata.my_char.TargetID); if (npc != null) { switch (req) { case "NAME": return(Util.GetNPCName(npc.NPCID)); case "TITLE": return(npc.Title); default: ScriptEngine.Script_Error("invalid target data(npc) request"); break; } } } //unlock finally { Globals.NPCLock.ExitReadLock(); } break; } return(""); }