예제 #1
0
 public static Packet Animation(ZoneCharacter character, byte id)
 {
     Packet packet = new Packet(SH8Type.Emote);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteByte(id);
     return packet;
 }
예제 #2
0
 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;
 }
예제 #3
0
파일: House.cs 프로젝트: iFeddy/SolarFiesta
 public House(ZoneCharacter pOwner, HouseType pType, ushort pItemID = 0, string pName = "")
 {
     this.Owner = pOwner;
     this.Type = pType;
     this.ItemID = pItemID;
     this.Name = pName;
 }
예제 #4
0
 public static void SendCharacterChunkEnd(ZoneCharacter character)
 {
     using (var packet = new Packet(SH4Type.CharacterInfoEnd))
     {
         packet.WriteUShort(0xFFFF);
         character.Client.SendPacket(packet);
     }
 }
예제 #5
0
 public static void FailedUnequip(ZoneCharacter character)
 {
     using (var packet = new Packet(SH12Type.FailedUnequip))
     {
         packet.WriteUShort(706);
         character.Client.SendPacket(packet);
     }
 }
예제 #6
0
 public static void FailedEquip(ZoneCharacter character, ushort val = 0)
 {
     using (var packet = new Packet(SH12Type.FailedEquip))
     {
         packet.WriteUShort(val);
         character.Client.SendPacket(packet);
     }
 }
예제 #7
0
 public static void SendChatBlock(ZoneCharacter character, int seconds)
 {
     using (var packet = new Packet(SH2Type.Chatblock))
     {
         packet.WriteInt(seconds);
         character.Client.SendPacket(packet);
     }
 }
예제 #8
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;
 }
예제 #9
0
 public static void SendDetailedCharacterInfo(ZoneCharacter character)
 {
     using (var packet = new Packet(SH6Type.DetailedCharacterInfo))
     {
         character.WriteDetailedInfoExtra(packet);
         character.Client.SendPacket(packet);
     }
 }
예제 #10
0
 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;
 }
예제 #11
0
 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);
     }
 }
예제 #12
0
 public static Packet Equip(ZoneCharacter character, Equip equip)
 {
     //B2 00 - AB 38 - 07 - 0D 00 04
     Packet packet = new Packet(SH7Type.ShowEquip);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteUShort(equip.ItemID);
     packet.WriteByte(equip.Upgrades);
     packet.Fill(3, 0xff);
     return packet;
 }
예제 #13
0
 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);
     }
 }
예제 #14
0
 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;
 }
예제 #15
0
파일: Skill.cs 프로젝트: iFeddy/SolarFiesta
 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;
 }
예제 #16
0
파일: Item.cs 프로젝트: iFeddy/SolarFiesta
 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);
 }
예제 #17
0
        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);
            }
        }
예제 #18
0
 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);
     }
 }
예제 #19
0
 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);
     }
 }
예제 #20
0
파일: Equip.cs 프로젝트: iFeddy/SolarFiesta
        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();
        }
예제 #21
0
 public void Send(ZoneCharacter character, ushort distance = 1000)
 {
     Handler15.SendQuestion(character, this, distance);
 }
예제 #22
0
 public static void SendUpdateSP(ZoneCharacter character)
 {
     using (var p = new Packet(SH9Type.HealSP))
     {
         p.WriteUInt(character.SP);
         p.WriteUShort(character.UpdateCounter);
         character.Client.SendPacket(p);
     }
 }
예제 #23
0
 public static void SendSkillStartSelf(ZoneCharacter user, ushort skillid, ushort victim, ushort animid)
 {
     // 9 78 | [04 06] [8A 27] [E5 3F]
     using (var packet = new Packet(SH9Type.SkillUsePrepareSelf))
     {
         packet.WriteUShort(skillid);
         packet.WriteUShort(victim);
         packet.WriteUShort(animid);
         user.Client.SendPacket(packet);
     }
 }
예제 #24
0
 public static void SendSkillOK(ZoneCharacter user)
 {
     // 9 53 |
     using (var packet = new Packet(SH9Type.SkillAck))
     {
         user.Client.SendPacket(packet);
     }
 }
예제 #25
0
        public static void SendLevelUPData(ZoneCharacter who, ushort mobid = 0xFFFF)
        {
            using (var packet = new Packet(SH9Type.LevelUP))
            {
                packet.WriteByte(who.Level);
                packet.WriteUShort(mobid);
                who.WriteDetailedInfoExtra(packet, true);

                who.Client.SendPacket(packet);
            }
        }
예제 #26
0
 public static void SendLevelUPAnim(ZoneCharacter who, ushort mobid = 0xFFFF)
 {
     using (var packet = new Packet(SH9Type.LevelUPAnimation))
     {
         packet.WriteUShort(who.MapObjectID);
         packet.WriteUShort(mobid);
         who.MapSector.Broadcast(packet);
     }
 }
예제 #27
0
 public static void SendGainEXP(ZoneCharacter who, uint amount, ushort mobid = 0xFFFF)
 {
     using (var packet = new Packet(SH9Type.GainEXP))
     {
         packet.WriteUInt(amount);
         packet.WriteUShort(mobid);
         who.Client.SendPacket(packet);
     }
 }
예제 #28
0
        private void WritePacket(ZoneCharacter character, params string[] param)
        {
            if (param.Length >= 3)
            {
                byte header = byte.Parse(param[1]);
                byte type = byte.Parse(param[2]);

                using (var packet = new Packet(header, type))
                {
                    if (param.Length > 3)
                    {
                        packet.WriteHexAsBytes(string.Join("", param, 3, param.Length - 3));
                    }
                    character.Client.SendPacket(packet);
                }
            }
        }
예제 #29
0
 public static Packet Unequip(ZoneCharacter character, Equip equip)
 {
     Packet packet = new Packet(SH7Type.ShowUnequip);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteByte((byte)equip.Info.Slot);
     return packet;
 }
예제 #30
0
 public static Packet SpawnSinglePlayer(ZoneCharacter character)
 {
     Packet packet = new Packet(SH7Type.SpawnSinglePlayer);
     character.WriteCharacterDisplay(packet);
     return packet;
 }