public Inventory(ZoneCharacter pChar) { InventoryCount = 2; InventoryOwner = pChar; InventoryItems = new Dictionary<byte, Item>(); EquippedItems = new List<Item>(); }
public CommandStatus ExecuteCommand(ZoneCharacter character, string[] command) { if (character == null) return CommandStatus.ERROR; CommandInfo info; if (commands.TryGetValue(command[0].ToLower(), out info)) { if (info.GmLevel > character.Client.Admin) { return CommandStatus.GM_LEVEL_TOO_LOW; } else { try { info.Function(character, command); return CommandStatus.DONE; } catch (Exception ex) { string wholeCommand = string.Join(" ", command); Log.WriteLine(LogLevel.Exception, "Exception while handling command '{0}': {1}", wholeCommand, ex.ToString()); return CommandStatus.ERROR; } } } else return CommandStatus.NOT_FOUND; }
public static Packet Animation(ZoneCharacter character, byte id) { Packet packet = new Packet(SH8Type.Emote); packet.WriteUShort(character.MapObjectID); packet.WriteByte(id); return packet; }
public TradeItem(ZoneCharacter owner,byte InventorySlot,byte Tradeslot,Item pItem) { this.Owner = owner; this.Item = pItem; this.InventorySlot = InventorySlot; this.TradeSlot = Tradeslot; }
public House(ZoneCharacter pOwner, HouseType pType, ushort pItemID = 0, string pName = "") { this.Owner = pOwner; this.Type = pType; this.ItemID = pItemID; this.Name = pName; }
public static int GetStatValue(ZoneCharacter pCharacter, StatsByte pByte) { switch (pByte) { case StatsByte.MinMelee: return pCharacter.MinDamage; case StatsByte.MaxMelee: return pCharacter.MaxDamage; case StatsByte.MinMagic: return pCharacter.MinMagic; case StatsByte.MaxMagic: return pCharacter.MaxMagic; case StatsByte.WDef: return pCharacter.WeaponDef; case StatsByte.MDef: return pCharacter.MagicDef; case StatsByte.Aim: return 5; //TODO load additional equip stats case StatsByte.Evasion: return 5; case StatsByte.StrBonus: return pCharacter.StrBonus; case StatsByte.EndBonus: return pCharacter.EndBonus; default: return 0; } }
public static Packet BeginDisplayRest(ZoneCharacter character) { Packet packet = new Packet(SH8Type.BeginDisplayRest); packet.WriteUShort(character.MapObjectID); packet.WriteUShort(character.House.ItemID); packet.Fill(10, 0xff); return packet; }
public static void SendChatBlock(ZoneCharacter character, int seconds) { using (var packet = new Packet(SH2Type.Chatblock)) { packet.WriteInt(seconds); character.Client.SendPacket(packet); } }
public static void SendCharacterChunkEnd(ZoneCharacter character) { using (var packet = new Packet(SH4Type.CharacterInfoEnd)) { packet.WriteUShort(0xFFFF); character.Client.SendPacket(packet); } }
public static void FailedEquip(ZoneCharacter character, ushort val = 0) { using (var packet = new Packet(SH12Type.FailedEquip)) { packet.WriteUShort(val); character.Client.SendPacket(packet); } }
public static void FailedUnequip(ZoneCharacter character) { using (var packet = new Packet(SH12Type.FailedUnequip)) { packet.WriteUShort(706); character.Client.SendPacket(packet); } }
public Trade(ZoneCharacter pFrom,ZoneCharacter pTo) { this.pCharFrom = pFrom; this.pCharTo = pTo; this.pCharFrom.Trade = this; this.pCharTo.Trade = this; SendTradeBeginn(); }
public static void SendDetailedCharacterInfo(ZoneCharacter character) { using (var packet = new Packet(SH6Type.DetailedCharacterInfo)) { character.WriteDetailedInfoExtra(packet); character.Client.SendPacket(packet); } }
public static bool GetLoggedInCharacter(int ID, out ZoneCharacter pChar) { pChar = ClientManager.Instance.GetClientByCharID(ID).Character; if (pChar != null) { return true; } return false; }
public static MobBreedLocation CreateLocationFromPlayer(ZoneCharacter pCharacter, ushort mobID) { MobBreedLocation mbl = new MobBreedLocation(); mbl.MobID = mobID; mbl.MapID = pCharacter.MapID; mbl.InstanceID = pCharacter.Map.InstanceID; mbl.Position = new Vector2(pCharacter.Position); return mbl; }
public static void SendSkillLearnt(ZoneCharacter character, ushort skillid) { using (var packet = new Packet(SH18Type.LearnSkill)) { packet.WriteUShort(skillid); packet.WriteByte(0); //unk character.Client.SendPacket(packet); } }
public static void SendChangeMap(ZoneCharacter character, ushort mapid, int x, int y) { using (var packet = new Packet(SH6Type.ChangeMap)) { packet.WriteUShort(mapid); packet.WriteInt(x); packet.WriteInt(y); character.Client.SendPacket(packet); } }
public static Packet Equip(ZoneCharacter character, Item equip) { //B2 00 - AB 38 - 07 - 0D 00 04 Packet packet = new Packet(SH7Type.ShowEquip); packet.WriteUShort(character.MapObjectID); packet.WriteUShort(equip.ID); packet.WriteByte(equip.UpgradeStats.Upgrades); packet.Fill(3, 0xff); return packet; }
public TradeReqest(ZoneCharacter pFrom, ushort ToMapObjectID) { if (pFrom.SelectedObject.MapObjectID == ToMapObjectID) { this.CrationTimeStamp = DateTime.Now; this.pToTradeClient = pFrom.SelectedObject as ZoneCharacter; this.pFromTradeClient = pFrom; this.MapID = pFrom.MapID; } }
public Skill(ZoneCharacter c, ushort id) { DatabaseSkill db = new DatabaseSkill(); db.Owner = c.ID; db.SkillID = (short)id; db.Upgrades = 0; db.IsPassive = false; db.Character = c.Character; Program.CharDBManager.GetClient().ExecuteQuery("INSERT INTO Skillist (ID,Owner,SkillID,Upgrades,IsPassive) VALUES ('" + c.Character.ID + "','" + db.SkillID + "','" + db.Upgrades + "','" + Convert.ToInt32(IsPassive) + "')"); skill = db; }
public static Packet SpawnMultiPlayer(List<ZoneCharacter> characters, ZoneCharacter exclude = null) { Packet packet = new Packet(SH7Type.SpawnMultiPlayer); packet.WriteByte(exclude == null ? (byte)characters.Count : (byte)(characters.Count - 1)); foreach (var character in characters) { if (character == exclude) continue; character.WriteCharacterDisplay(packet); } return packet; }
public static void SendGameMessage(ZoneCharacter character, string Message, string script) { using (var packet = new Packet(SH27Type.GameMessage)) { packet.WriteString(script, 31); packet.WriteByte(24); packet.WriteInt(Message.Length); packet.WriteByte(0); packet.WriteString(Message, Message.Length); character.Client.SendPacket(packet); } }
public Skill(ZoneCharacter c, ushort ID) { DatabaseSkill db = new DatabaseSkill(); db.Owner = c.ID; db.SkillID = (short)ID; db.Upgrades = 0; db.IsPassive = false; db.Character = c.character; Program.Entity.AddToDatabaseSkills(db); Program.Entity.SaveChanges(); _skill = db; }
public Item(DroppedItem item, ZoneCharacter pNewOwner, sbyte pSlot) { DatabaseItem dbi = new DatabaseItem(); dbi.Amount = item.Amount; dbi.Character = pNewOwner.character; dbi.ObjectID = item.ItemID; dbi.Slot = pSlot; Program.Entity.AddToDatabaseItems(dbi); Program.Entity.SaveChanges(); _item = dbi; ItemID = item.ItemID; pNewOwner.InventoryItems.Add(pSlot, this); }
public static void SendChangeZone(ZoneCharacter character, ushort mapid, int x, int y, string ip, ushort port, ushort randomid) { using (var packet = new Packet(SH6Type.ChangeZone)) { packet.WriteUShort(mapid); packet.WriteInt(x); packet.WriteInt(y); packet.WriteString(Settings.Instance.IP, 16); packet.WriteUShort(port); packet.WriteUShort(randomid); character.Client.SendPacket(packet); } }
public static void SendChangeZone(ZoneCharacter character, ushort mapid, int x, int y, string IP, ushort port, ushort randomid) { using (var packet = new Packet(SH6Type.ChangeZone)) { packet.WriteUShort(mapid); packet.WriteInt(x); packet.WriteInt(y); packet.WriteString(character.Client.Host == "127.0.0.1" ? "127.0.0.1" : IP, 16); packet.WriteUShort(port); packet.WriteUShort(randomid); character.Client.SendPacket(packet); } }
public static void SendActiveSkillList(ZoneCharacter character) { using (var packet = new Packet(SH4Type.CharacterActiveSkillList)) { var list = character.SkillsActive.Values; packet.WriteByte(0); packet.WriteInt(character.ID); packet.WriteUShort((ushort)list.Count); // Skill count (max 300) foreach (var skill in list) { skill.Write(packet); } character.Client.SendPacket(packet); } }
public static void SendQuestion(ZoneCharacter character, Question question, ushort range) { using (var packet = new Packet(SH15Type.Question)) { packet.WriteString(question.Text, 129); packet.WriteUShort(character.MapObjectID); // Obj id packet.WriteInt(character.Position.X); packet.WriteInt(character.Position.Y); packet.WriteUShort(range); // Distance how far your allowed to run when the question window is closed by Client packet.WriteByte((byte)question.Answers.Count); for (byte i = 0; i < question.Answers.Count; ++i) { packet.WriteByte(i); packet.WriteString(question.Answers[i], 32); } character.Client.SendPacket(packet); } }
public Equip(DroppedEquip pBase, ZoneCharacter pNewOwner, sbyte pSlot) { DatabaseEquip dbeq = new DatabaseEquip(); dbeq.IncDex = pBase.Dex; dbeq.IncStr = pBase.Str; dbeq.IncEnd = pBase.End; dbeq.IncInt = pBase.Int; dbeq.IncSpr = pBase.Spr; dbeq.Upgrades = pBase.Upgrades; dbeq.EquipID = pBase.ItemID; dbeq.Slot = pSlot; dbeq.Character = pNewOwner.character; Program.Entity.AddToDatabaseEquips(dbeq); equip = dbeq; ItemID = (ushort)dbeq.EquipID; pNewOwner.InventoryItems.Add(pSlot, this); pNewOwner.Save(); }
public static void SendChangeZoneToWorld(ZoneCharacter character, ushort mapid, int x, int y, string ip, ushort port, ushort randomid) { using (var packet = new InterPacket(InterHeader.ChangeZone)) { packet.WriteUShort(mapid); packet.WriteInt(x); packet.WriteInt(y); packet.WriteString(character.Name,16); packet.WriteString(Settings.Instance.IP, 16); packet.WriteUShort(port); packet.WriteUShort(randomid); WorldConnector.Instance.SendPacket(packet); } }