Пример #1
0
        public static void SendPartyInformation(ZoneClient client)
        {
            if (Program.Entity.Parties.Where(c => c.CharNo == client.Character.ID).Count() == 1)
            {
                Party PartyNo = Program.Entity.Parties.First(c => c.CharNo == client.Character.ID);
                foreach (Party party in Program.Entity.Parties.Where(c => c.PartyNo == PartyNo.PartyNo))
                {
                    Character Pcharacter = Program.Entity.Characters.First(c => c.ID == party.CharNo);
                    ZoneClient otherLiveInfo = ClientManager.Instance.GetClientByName(Pcharacter.Name);
                    if (otherLiveInfo != null)
                    {
                        if (otherLiveInfo.Character.MapID == client.Character.MapID)
                        {
                            using (var ppacket = new Packet(SH14Type.PartyInformationShort))
                            {
                                ppacket.WriteByte(1);
                                ppacket.WriteString(otherLiveInfo.Character.Name, 16);
                                ppacket.WriteUInt(otherLiveInfo.Character.HP);
                                ppacket.WriteUInt(otherLiveInfo.Character.SP);
                                ppacket.WriteUInt(otherLiveInfo.Character.LP);
                                client.SendPacket(ppacket);
                            }

                            using (var ppacket = new Packet(SH14Type.PartyInformation))
                            {
                                ppacket.WriteByte(1); //unk
                                ppacket.WriteString(otherLiveInfo.Character.Name, 16);
                                ppacket.WriteByte((byte)otherLiveInfo.Character.Job);
                                ppacket.WriteByte(otherLiveInfo.Character.Level);
                                ppacket.WriteUInt(otherLiveInfo.Character.HP);
                                ppacket.WriteUInt(otherLiveInfo.Character.SP);
                                ppacket.WriteUInt(otherLiveInfo.Character.LP);
                                ppacket.WriteByte(1); //unk
                                client.SendPacket(ppacket);
                            }

                            using (var ppacket = new Packet(SH14Type.PartyLoginCord))
                            {
                                ppacket.WriteByte(1); //unk
                                ppacket.WriteString(otherLiveInfo.Character.Name, 16);
                                ppacket.WriteInt(otherLiveInfo.Character.Position.X);
                                ppacket.WriteInt(otherLiveInfo.Character.Position.Y);
                                client.SendPacket(ppacket);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
 public static void SendPing(ZoneClient character)
 {
     using (var packet = new Packet(SH2Type.Ping))
     {
         character.SendPacket(packet);
     }
 }
Пример #3
0
 public static void SendError(ZoneClient client, ServerError error)
 {
     using (Packet pack = new Packet(SH3Type.Error))
     {
         pack.WriteShort((byte)error);
         client.SendPacket(pack);
     }
 }
Пример #4
0
        public static void UseHPStoneHandler(ZoneClient client, Packet packet)
        {
            if (client.Character.StonesHP == 0)
            {
                using (var p = new Packet(SH20Type.ErrorUseStone))
                {
                    client.SendPacket(p);
                }
            }
            else
            {
                client.Character.HealHP((uint)client.Character.BaseStats.SoulHP);

                using (var p = new Packet(SH20Type.StartHPStoneCooldown))
                {
                    client.SendPacket(p);
                }
            }
        }
Пример #5
0
        public static void BuySPStonesFromNPC(ZoneClient client, Packet packet)
        {
            short amount;
            ZoneCharacter character = client.Character;
            if (!packet.TryReadShort(out amount))
            {
                Log.WriteLine(LogLevel.Debug, "BuySPStones :: Got unknown amount from {0}", character.Name);
            }

            using (var ppacket = new Packet(SH20Type.ChangeSPStones))
            {
                using (var pppacket = new Packet(SH4Type.MoneyChange))
                {
                    character.BuySPStones(ppacket, pppacket, amount);
                    client.SendPacket(ppacket);
                    client.SendPacket(pppacket);
                }
            }
        }
Пример #6
0
 public static void MasterRequestCoper(ZoneClient client, Packet pPacket)
 {
     byte unk;
     if (!pPacket.TryReadByte(out unk))
         return;
     using (var packet = new Packet(SH37Type.SendRecivveCopper))
     {
         packet.WriteUShort(7264);//unk
         packet.WriteLong(client.Character.Character.ReviveCoper);
         client.SendPacket(packet);
     }
 }
Пример #7
0
        public static void MasterRequestAcceptCoper(ZoneClient client, Packet pPacket)
        {
            client.Character.Character.ReviveCoper = 0;
             InterServer.InterHandler.SendReciveCoper(client.Character.Character.Name, client.Character.Character.ReviveCoper,true);
             using(var packet = new Packet(37,65))
             {

                packet.WriteUShort(7272);//unk
                packet.WriteLong(client.Character.RecviveCoper);
                client.SendPacket(packet);
             }
        }
Пример #8
0
        public static void HandleTrade(ZoneClient client, Packet packet)
        {
            ushort PlayerObjID;
            if (!packet.TryReadUShort(out PlayerObjID))
            {
                Packet ppacket = new Packet(SH19Type.TradeNotAccepted);
                ppacket.WriteUShort(client.Character.MapObjectID);
                client.SendPacket(ppacket);
                Log.WriteLine(LogLevel.Error, "TradeRequest :: Invalid Obj ID from {0}", client.Character.Name);
            }

            SendTradeRequest(client, PlayerObjID);
        }
Пример #9
0
 public static void BySPStoneHandler(ZoneClient client, Packet packet)
 {
     short Amount;
     if (packet.TryReadShort(out Amount))
     {
         client.Character.ChangeMoney(client.Character.Character.Money -= client.Character.BaseStats.PriceSPStone);
         short Am = Amount += client.Character.StonesSP;
         client.Character.StonesHP = Am;
         using (var p = new Packet(SH20Type.ChangeSPStones))
         {
             p.WriteShort(Am);
             client.SendPacket(p);
         }
     }
 }
Пример #10
0
 public static void SendMoveIteminContaInComplet(ZoneClient pClient)
 {
     using (var packet = new Packet(SH12Type.MoveIteminContaInComplet))
     {
         packet.WriteUShort(577);
         pClient.SendPacket(packet);
     }
 }
Пример #11
0
        public static void UseTeleporter(ZoneClient client, Packet packet)
        {
            byte anwser;
            if (packet.TryReadByte(out anwser))
            {
                using (Packet Packet = new Packet(SH6Type.TelePorter))
                {
                    Packet.WriteShort(6593);//code for normal teleport
                    client.SendPacket(Packet);
                }
                switch (anwser)
                {
                    case 0:
                        client.Character.ChangeMap(0, 4199, 4769);//Roumen

                        break;
                    case 1:
                        client.Character.ChangeMap(9, 11802, 10466);//Eldrine

                        break;
                    case 2:
                        client.Character.ChangeMap(75, 9069, 9312);//EldGbl02
                        break;
                    case 3:
                        client.Character.ChangeMap(5,13658,7812);//RouVal01

                        break;
                    default:
                        Log.WriteLine(LogLevel.Warn,"Unkown Teleport Answer {1}",anwser);
                        break;
                }
            }
        }
Пример #12
0
 private void SendTradeAgreepTo(ZoneClient pClient)
 {
     using (var packet = new Packet(SH19Type.SendTradeAgreeTo))
     {
         pClient.SendPacket(packet);
     }
 }
Пример #13
0
 private void SendTradeAddItemMe(ZoneClient pClient,byte pSlot,byte TradeSlot)
 {
     using (var packet = new Packet(SH19Type.SendAddItemSuccefull))
     {
         packet.WriteByte(pSlot);
         packet.WriteByte(TradeSlot);
         pClient.SendPacket(packet);
     }
 }
Пример #14
0
 public static void SendUsablePoints(ZoneClient client)
 {
     using (var packet = new Packet(SH4Type.CharacterPoints))
     {
         packet.WriteByte(client.Character.Character.UsablePoints);
         client.SendPacket(packet);
     }
 }
Пример #15
0
 public static void SendSetUsablePoint(ZoneClient client, byte stat)
 {
     using (var packet = new Packet(SH4Type.SetPointOnStat))
     {
         packet.WriteByte(stat); // amount
         client.SendPacket(packet);
     }
 }
Пример #16
0
 public static void SendReviveWindow(ZoneClient client, byte minutesTillExpire)
 {
     using (var packet = new Packet(SH4Type.ReviveWindow))
     {
         packet.WriteByte(minutesTillExpire); // It's not a short, the byte after it is buffershit
         client.SendPacket(packet);
     }
 }
Пример #17
0
 public static void SendRevive(ZoneClient client, ushort mapid, int x, int y)
 {
     using (var packet = new Packet(SH4Type.Revive))
     {
         packet.WriteUShort(mapid);
         packet.WriteInt(x);
         packet.WriteInt(y);
         client.SendPacket(packet);
     }
 }
Пример #18
0
 public static void SendConnectError(ZoneClient client, ConnectErrors error)
 {
     using (var packet = new Packet(SH4Type.ConnectError))
     {
         packet.WriteUShort((ushort)error);
         client.SendPacket(packet);
     }
 }
Пример #19
0
 public static void SendStatsUpdate(MapObject pObject, ZoneClient to, bool selectedby)
 {
     using (var packet = new Packet(SH9Type.StatUpdate))
     {
         packet.WriteBool(selectedby);
         packet.WriteUShort(pObject.MapObjectID);
         if (pObject is ZoneCharacter)
         {
             ((ZoneCharacter)pObject).WriteUpdateStats(packet);
         }
         else
         {
             ((Mob)pObject).WriteUpdateStats(packet);
         }
         to.SendPacket(packet);
     }
 }
Пример #20
0
 private void SendItemRemoveMe(ZoneClient pClient,byte pTradeSlot)
 {
     using (var packet = new Packet(SH19Type.SendItemRemove))
     {
         packet.WriteByte(pTradeSlot);
         pClient.SendPacket(packet);
     }
 }
Пример #21
0
 public static void SendAdminNotice(ZoneClient client, string text)
 {
     using (var packet = new Packet(SH8Type.GmNotice))
     {
         packet.WriteByte((byte)text.Length);
         packet.WriteString(text, text.Length);
         client.SendPacket(packet);
     }
 }
Пример #22
0
 public static void SendNpcInteraction(ZoneClient client, Npc npc)
 {
     switch (npc.Point.RoleArg0)
     {
         case "Guild":
             if (npc.Point.Role == "NPCMenu")
             {
                 using (var packet = new Packet(SH15Type.GuildNpcReqest))
                 {
                     client.SendPacket(packet);
                 }
             }
             else
             {
                 using (var packet = new Packet(SH8Type.Interaction))
                 {
                     packet.WriteUShort(npc.ID);
                     client.SendPacket(packet);
                 }
             }
             break;
         case "Quest":
             //:TODO Quest Proggresion
             using (var packet = new Packet(SH8Type.Interaction))
             {
                 packet.WriteUShort(npc.ID);
                 client.SendPacket(packet);
             }
             Console.WriteLine(npc.Point.RoleArg0);
             break;
         default:
             using (var packet = new Packet(SH8Type.Interaction))
             {
                 packet.WriteUShort(npc.ID);
                 client.SendPacket(packet);
             }
             break;
     }
 }
Пример #23
0
 private void SendChangeMoney(ZoneClient pClient, long money)
 {
     using (var packet = new Packet(SH19Type.SendChangeMoney))
     {
         packet.WriteLong(money);
         pClient.SendPacket(packet);
     }
 }
Пример #24
0
 public static void SendBeginRestResponse(ZoneClient client, ushort value)
 {
     /*  0x0A81 - OK to rest
            0x0A82 - Can't rest on mount
            0x0A83 - Too close to NPC*/
     using (var packet = new Packet(SH8Type.BeginRest))
     {
         packet.WriteUShort(value);
         client.SendPacket(packet);
     }
 }
Пример #25
0
 private void SendItemRemovFromHandel(ZoneClient pClient, byte Slot)
 {
     using (var packet = new Packet(SH19Type.SendRemoveItemFromHandel))
     {
         packet.WriteByte(Slot);
         pClient.SendPacket(packet);
     }
 }
Пример #26
0
 public static void SendEndRestResponse(ZoneClient client)
 {
     using (var packet = new Packet(SH8Type.EndRest))
     {
         packet.WriteUShort(0x0a81);
         client.SendPacket(packet);
     }
 }
Пример #27
0
        private void SendTradeAddItemTo(ZoneClient pClient,Item pItem,byte TradepSlot)
        {
            using (var packet = new Packet(SH19Type.SendAddItem))
            {
                packet.WriteByte(TradepSlot);
                if (pItem.ItemInfo.Slot == ItemSlot.None)

                    pItem.WriteStats(packet);

                else

                   pItem.WriteEquipStats(packet);

              pClient.SendPacket(packet);
            }
        }
Пример #28
0
 public static void SendNPCInteraction(ZoneClient client, ushort ID)
 {
     using (var packet = new Packet(SH8Type.Interaction))
     {
         packet.WriteUShort(ID);
         client.SendPacket(packet);
     }
 }
Пример #29
0
 private void SendTradeLock(ZoneClient pClient)
 {
     using (var packet = new Packet(SH19Type.SendTradeLock))
     {
         pClient.SendPacket(packet);
     }
 }
Пример #30
0
        public static void GuildExtraRequest(ZoneClient client, Packet packet)
        {
            if (client.Character.Guild == null && client.Character.GuildAcademy == null)
                return;
            byte response;
            ushort ResponseCode;
            if (!packet.TryReadByte(out response))
                return;
            switch (response)
            {
                case 0:
                    if (client.Character.Guild == null)
                    {
                        //todo Response for is not in Guild end academymember
                        return;
                    }
                  ResponseCode = 6104;
                    break;
                case 1:

                    break;
                case 2:
                    break;
            }
            if (!client.Character.IsInaAcademy)
            {
                using (var pack = new Packet(SH38Type.GuildItemList))
                {

                    pack.WriteUShort(6104);//Responsecode //
                    pack.WriteLong(client.Character.Guild.GuildMoney);//guildmoney
                    pack.WriteByte((byte)client.Character.Guild.GuildStore.GuildStorageItems.Count);//ItemCount
                    foreach (var pItem in client.Character.Guild.GuildStore.GuildStorageItems.Values)
                    {
                        if (pItem.ItemInfo.Slot == ItemSlot.None)
                        {
                            pItem.WriteInfo(pack);
                            pack.WriteByte((byte)pItem.Ammount);//amount
                        }
                        else
                        {
                            pItem.WriteInfo(pack);

                        }
                    }
                    client.SendPacket(pack);
                }
            }
            else
            {
                using (var pack = new Packet(SH38Type.GuildItemList))
                {

                    pack.WriteUShort(6104);//Responsecode //
                    pack.WriteLong(client.Character.Guild.GuildMoney);//guildmoney
                    pack.WriteByte((byte)client.Character.GuildAcademy.Guild.GuildStore.GuildStorageItems.Count);//ItemCount
                    foreach (var pItem in client.Character.GuildAcademy.Guild.GuildStore.GuildStorageItems.Values)
                    {
                        if (pItem.ItemInfo.Slot == ItemSlot.None)
                        {
                            pItem.WriteInfo(pack);
                            pack.WriteByte((byte)pItem.Ammount);//amount
                        }
                        else
                        {
                            pItem.WriteInfo(pack);

                        }
                    }
                    client.SendPacket(pack);
                }
            }
        }