Ejemplo n.º 1
0
        private void Handle_UserTransferFieldRequest(WvsGameClient c, CInPacket p)
        {
            if (p.Available == 0)
            {
                //Cash Shop Related
                return;
            }

            //TODO: Portal count checks
            //TODO: XY rect checks
            //TODO: Keep track if player spawns when entering a field

            var portalCount = p.Decode1(); //CField::GetFieldKey(v20);
            var destination = p.Decode4(); //
            var portalName  = p.DecodeString();
            var x           = p.Decode2();
            var y           = p.Decode2();
            //var extra = p.DecodeBuffer(3); idk | prem | chase

            var portal =
                c.GetCharField()
                .Portals
                .GetByName(portalName);

            if (portal == null)
            {
                Logger.Write(LogLevel.Warning, "Client tried to enter non existant portal {0}", portalName);
            }
            else
            {
                c.UsePortal(portal);
            }
        }
Ejemplo n.º 2
0
        public static void DeleteCharacter(WvsLoginClient c, CInPacket p)
        {
            var szSPW    = p.DecodeString();
            var dwCharID = p.Decode4();

            // TODO check for guild ownership and family membership

            byte nRetCode  = 0x09; //Error
            var  aCharList = c.Account.LoadCharIdList();

            if (aCharList.Contains(dwCharID))
            {
                using (var conn = new NpgsqlConnection(Constants.DB_World0_ConString))
                {
                    conn.Open();

                    using (var cmd = new NpgsqlCommand($"DELETE FROM {Constants.DB_All_World_Schema_Name}.characters WHERE id = {dwCharID}", conn))
                    {
                        cmd.ExecuteNonQuery();
                    }
                }

                nRetCode = 0; //Success
            }

            c.SendPacket(CPacket.CLogin.DeleteCharacter(dwCharID, nRetCode));
        }
        public static void Handle(int nSkillID, byte nSLV, Character character, CInPacket p)
        {
            //          COutPacket::COutPacket(&oPacket, 103);
            //          LOBYTE(v37) = 2;
            //          v23 = get_update_time();
            //          COutPacket::Encode4(&oPacket, v23);
            //          COutPacket::Encode4(&oPacket, pSkill->nSkillID);
            //          COutPacket::Encode1(&oPacket, nSLV);
            //          v24 = adwUserID.a;
            //          if (adwUserID.a)
            //              v25 = *(adwUserID.a - 1);
            //          else
            //              LOBYTE(v25) = 0;
            //          COutPacket::Encode1(&oPacket, v25);
            //          v26 = 0;
            //          if (ZArray < unsigned long>::GetCount(&adwUserID) )
            //{
            //              do
            //                  COutPacket::Encode4(&oPacket, v24[v26++]);
            //              while (v26 < ZArray < unsigned long>::GetCount(&adwUserID) );
            //          }
            //          COutPacket::Encode2(&oPacket, (unsigned __int16)cd);
            //          CClientSocket::SendPacket(TSingleton < CClientSocket >::ms_pInstance, &oPacket);

            var v25 = p.Decode1();

            var ZArray = p.DecodeIntArray(v25);

            var cd = p.Decode2();
        }
Ejemplo n.º 4
0
        public void OnCompleteQuest(CInPacket p, short nQuestID, int dwNpcTemplateID, bool bIsAutoComplete)
        {
            var nSelect = bIsAutoComplete ? -1 : p.Decode4();

            if (!CheckDemand(nQuestID, dwNpcTemplateID, 1))
            {
                Parent.SendPacket(CPacket.CQuestMan.UserQuestResult(QuestResultType.Failed_Unknown, null));
                return;
            }

            var nActCompleteResult = TryQuestAct(nQuestID, 1);

            if (nActCompleteResult == QuestResultType.Failed_Unknown)
            {
                return;
            }

            if (nActCompleteResult == QuestResultType.Success)
            {
                this[nQuestID].tCompleted = DateTime.Now;
                this[nQuestID].nState     = QuestActType.QuestComplete;
            }

            var endActNextQuest = MasterManager.QuestTemplates[nQuestID].EndAct?.NextQuest ?? 0;

            Parent.SendPacket(CPacket.CQuestMan
                              .UserQuestResult(nActCompleteResult, this[nQuestID], dwNpcTemplateID, (short)endActNextQuest));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Move an item from the character's account cash locker to the character's storage.
        /// </summary>
        /// <param name="c"></param>
        /// <param name="p"></param>
        public static void MoveLToS(WvsShopClient c, CInPacket p)
        {
            if (p.Available < 8)
            {
                return;
            }

            var sn = p.Decode8();

            var cashItem = c.CashLocker.GetBySN(sn);

            // unable to find item
            if (cashItem == null)
            {
                return;
            }

            var nTargetSlot = InventoryManipulator.InsertInto(c.Character, cashItem.Item);

            // item insertion failed
            if (nTargetSlot == 0)
            {
                return;                               // TODO proper error code/response
            }
            c.CashLocker.Remove(cashItem);

            c.SendPacket(CPacket.CCashShop.MoveLtoSResponse(cashItem, nTargetSlot));
        }
Ejemplo n.º 6
0
        //========================

        public void OnRequestPacket(WvsGameClient c, CInPacket p)
        {
            var pChar  = c.Character;
            var opCode = (PartyOps)p.Decode1();

            switch (opCode)
            {
            case PartyOps.CreateParty:
                Create(pChar, p);
                break;

            case PartyOps.LeaveParty:
                Leave(pChar, p);
                break;

            //case PartyOps.JoinParty:
            //    Join(pChar, p);
            //    break;
            case PartyOps.InviteParty:
                Invite(pChar, p);
                break;

            case PartyOps.KickParty:
                Kick(pChar, p);
                break;

            case PartyOps.ChangePartyLeader:
                ChangePartyLeader(pChar, p);
                break;
            }
            c.Character.Action.Enable();
        }
Ejemplo n.º 7
0
        public void OnPacket(RecvOps opCode, CInPacket p, Character c)
        {
            if (c.Stats.nHP <= 0)
            {
                return;
            }

            var dwID = p.Decode4();
            var item = this[dwID];

            if (item is null)
            {
                return;
            }

            switch (opCode)
            {
            case RecvOps.CP_ReactorHit:
                item.Hit(c, p);
                break;

            case RecvOps.CP_ReactorTouch:
                item.Touch(c, p);
                break;
            }
            var provider = ServerApp.Container.Resolve <ScriptManager>();
            var script   = provider.GetReactorScript
                               (item.sName, item, c.Socket, opCode == RecvOps.CP_ReactorHit);

            script.Execute();
        }
Ejemplo n.º 8
0
        public static void Handle_SummonedHit(WvsGameClient c, CInPacket p)
        {
            int dwSummonedID = p.Decode4();
            var item         = c.Character.Field.Summons[dwSummonedID];

            if (item is null)
            {
                return;
            }

            var nAttackIdx = p.Decode1();
            var nDamage    = p.Decode4();
            var dwMobID    = p.Decode4();
            var bLeft      = p.Decode1();

            if (item.nCurHP <= 0 || item.Field.Mobs[dwMobID] is null || item.Field.Mobs[dwMobID].Stats.HP <= 0)
            {
                return;
            }

            item.Field.Broadcast(CPacket.CSummonedPool.SummonedHit(item, nAttackIdx, nDamage, dwMobID, bLeft));

            if (nDamage >= item.nCurHP)
            {
                item.nLeaveType = SummonLeaveType.LEAVE_TYPE_SUMMONED_DEAD;
                item.Field.Summons.Remove(item);
            }
            else
            {
                item.nCurHP -= (short)nDamage;
            }
        }
Ejemplo n.º 9
0
        public static GW_ItemSlotBase Decode(CInPacket p)
        {
            var             type = p.Decode1();
            GW_ItemSlotBase ret  = null;

            if (type == 1)
            {
                ret = new GW_ItemSlotEquip();
            }

            if (type == 2)
            {
                ret = new GW_ItemSlotBundle();
            }

            if (type == 2)
            {
                ret = new GW_ItemSlotPet();
            }

            if (ret == null)
            {
                throw new Exception("Unknown item type");
            }

            ret.RawDecode(p);
            return(ret);
        }
Ejemplo n.º 10
0
        public static void CashShop(WvsGameClient c, CInPacket p)
        {
            if (c.Character.Stats.nHP <= 0)
            {
                return;
            }
            if (c.Character.Field.Template.HasMigrateLimit())
            {
                return;
            }
            if (c.Character.Field.IsInstanced)
            {
                return;
            }

            var Parent = c.Character;

            Parent.Socket.Account.Save();
            Parent.Stats.Channel = Parent.Socket.ChannelId;
            Parent.Save();

            var center = ServerApp.Container.Resolve <WvsCenter>();

            var nPort = (short)center.WvsShop.Port;

            var storage = ServerApp.Container.Resolve <CenterStorage>();

            storage.AddCharacterMigrate(Parent.dwId);
            storage.AddCharacterCSITC(Parent.dwId);

            Parent.NotifySocialChannels(SocialNotiflag.MigrateCashShop);

            Parent.SendPacket(CPacket.MigrateCommand(Constants.ServerAddress, nPort));
        }
Ejemplo n.º 11
0
        public static void UserChat(WvsGameClient c, CInPacket p)
        {
            p.Decode4();
            var sText        = p.DecodeString();
            var bOnlyBalloon = p.Decode1() != 0;

            if (sText.Length >= sbyte.MaxValue)
            {
                return;
            }

            var handle = ServerApp.Container.Resolve <CommandHandle>();

            if (!handle.Execute(c.Character, sText))
            {
                var bAdmin = c.Account.AccountData.Admin > 0;
                CCurseProcess.ProcessString(sText, out var output);

                if (output.Length <= 0)
                {
                    return;
                }

                c.Character.Field.Broadcast(CPacket.UserChat(c.Character.dwId, output, bAdmin, bOnlyBalloon));
            }
        }
Ejemplo n.º 12
0
        public static void ITC(WvsGameClient c, CInPacket p)
        {
            if (c.Character.Stats.nHP <= 0)
            {
                return;
            }
            if (c.Character.Field.Template.HasMigrateLimit())
            {
                return;
            }
            if (c.Character.Field.IsInstanced)
            {
                return;
            }

            var Parent = c.Character;

            if (Parent.Stats.nLevel < 16)
            {
                Parent.SendPacket(CPacket.TransferChannelReqIgnore(5));
            }
            else
            {
                //Real Logic Here : Disabled it for now
                Parent.SendPacket(CPacket.TransferChannelReqIgnore(3));
            }
        }
Ejemplo n.º 13
0
        private void Handle_UserChangeSlotPositionRequest(WvsGameClient c, CInPacket p)
        {
            var tick     = p.Decode4();
            var type     = p.Decode1(); // inventory
            var src      = p.Decode2();
            var dst      = p.Decode2();
            var quantity = p.Decode2();

            Logger.Write(LogLevel.Debug, "UserChangeSlotPositionRequest Src {0}, Dst {1} Type {2} Qty {3}", src, dst, type, quantity);

            if (src < 0 && dst > 0)
            {
                CInventoryManipulator.UnEquip(c, src, dst); //check
            }
            else if (dst < 0)
            {
                CInventoryManipulator.Equip(c, src, dst); //check
            }
            else if (dst == 0)
            {
                CInventoryManipulator.Drop(c, type, src, quantity);
            }
            else
            {
                CInventoryManipulator.Move(c, type, src, dst); //check
            }
        }
Ejemplo n.º 14
0
        private void Handle_UserSelectNpc(WvsGameClient c, CInPacket p)
        {
            var dwNpcId = p.Decode4();
            var nPosX   = p.Decode2();
            var nPosY   = p.Decode2();

            if (c.NpcScript != null)
            {
                Logger.Write(LogLevel.Warning, "Npc script already in progress?");
            }

            var field = c.GetCharField();
            var npc   = field.Npcs.Get(dwNpcId);

            if (npc != null)
            {
                //if (npc.hasShop())
                //{
                //    chr.setConversation(1);
                //    npc.sendShop(c);
                //}
                //else
                {
                    c.NpcScript = NpcScript.GetScript(npc.Id, c);
                    c.NpcScript.Execute();
                }
            }
            else
            {
                Logger.Write(LogLevel.Warning, "Unable to find NPC {0}", dwNpcId);
            }
        }
Ejemplo n.º 15
0
        private void Handle_CheckDuplicatedID(WvsLoginClient c, CInPacket p)
        {
            var  charName  = p.DecodeString();
            bool nameTaken = IsUsernameTaken(charName);

            c.SendPacket(CPacket.CheckDuplicatedIDResult(charName, nameTaken));
        }
Ejemplo n.º 16
0
        public static TagPoint DecodePos(this CInPacket packet)
        {
            var x = packet.Decode2();
            var y = packet.Decode2();

            return(new TagPoint(x, y));
        }
Ejemplo n.º 17
0
        private void Handle_DeleteCharacter(WvsLoginClient c, CInPacket p)
        {
            var uid = p.Decode4();

            c.SendPacket(CPacket.DeleteCharacter(uid, 0));
            //Because I have no pin or pic the game wont let me dlete chars lol
        }
        public static void Handle(int nSkillID, byte nSLV, Character c, CInPacket p)
        {
            //COutPacket::COutPacket(&oPacket, 103);
            //v33 = 1;
            //v15 = get_update_time();
            //COutPacket::Encode4(&oPacket, v15);
            //COutPacket::Encode4(&oPacket, pSkill->nSkillID);
            //v16 = nSLV;
            //COutPacket::Encode1(&oPacket, nSLV);
            //v17 = (unsigned __int16 *)((int(__thiscall *)(IVecCtrlOwnerVtbl * *, ZRef < CharacterData > *))v3->vfptr->GetPos)(
            //                               &v3->vfptr,
            //                               &result);
            //COutPacket::Encode2(&oPacket, *v17);
            //v18 = ((int(__thiscall *)(IVecCtrlOwnerVtbl * *, char *))v3->vfptr->GetPos)(&v3->vfptr, &v31);
            //COutPacket::Encode2(&oPacket, *(_WORD*)(v18 + 4));
            //CClientSocket::SendPacket(TSingleton < CClientSocket >::ms_pInstance, &oPacket);

            // position of aura?
            var x = p.Decode2();
            var y = p.Decode2();

            var bLeft = x < c.Position.X;

            c.Skills.Cast(nSkillID, bLeft);
        }
Ejemplo n.º 19
0
        private void Create(Character c, CInPacket p)
        {
            if (c.Stats.nLevel < 10)
            {
                c.SendPacket(CPacket.CPartyMan.Party_Error(PartyOps.PartyRes_CreateNewParty_Beginner));
                return;
            }

            if (GetParty(c) is null)
            {
                var party = new Party
                {
                    PartyID   = PartyIDs.NextValue(),
                    dwOwnerId = c.dwId
                };

                party.Add(new PartyMember(c.dwId));
                Add(party);
                party[c.dwId].Update();

                c.SendPacket(CPacket.CPartyMan.CreateNewParty_Done(party));
            }
            else
            {
                c.SendPacket(CPacket.CPartyMan.Party_Error(PartyOps.PartyRes_JoinParty_AlreadyJoined));
            }
        }
Ejemplo n.º 20
0
        public static MapleAttack ParseBody(CInPacket p, Character c)
        {
            return(ParseMelee(p, c));            //TODO: Confirm below one day. Delta said melee works for this

            // Recv [CP_UserBodyAttack] [32 00] [01] [FF FF FF FF] [FF FF FF FF] [11] [FF FF FF FF] [FF FF FF FF] [CB F9 41 01] [00] [C3 C0 24 6A] [1F 46 7E D1] [9D D4 DD D5] [9D D4 DD D5] [00 00] 80 5F CF 88 C3 02 00 F9 9E D9 1F 00 00 00 00 2F 27 00 00 07 00 01 05 A9 00 8B 01 A5 00 8B 01 00 00 0B 00 00 00 B8 8D DB 27 B9 00 8B 01

            MapleAttack ret = new MapleAttack();

            p.Decode1();                                   // field key
            p.Decode4();                                   // pDrInfo.dr0
            p.Decode4();                                   // pDrInfo.dr1

            ret.nDamagePerMob = (byte)(p.Decode1() & 0xF); // nDamagePerMob | 0x10 * nRange

            p.Decode4();                                   // pDrInfo.dr2
            p.Decode4();                                   // pDrInfo.dr3

            ret.nSkillID = p.Decode4();

            ret.ValidateSkill(c);
            if (!ret.bValidAttack)
            {
                return(ret);
            }

            p.Decode1();             // cd->nCombatOrders
            p.Decode4();             // get_rand(pDrInfo.dr0, 0)
            p.Decode4();             // CCrc32::GetCrc32(pData, 4u, n, 0, 0)

            // todo lol

            return(null);
        }
Ejemplo n.º 21
0
        public void Move(Character pUser, CInPacket p)
        {
            var dwNpcId = p.Decode4();
            var item    = this[dwNpcId];

            if (item == null)
            {
                return;
            }
            if (item.Controller != pUser)
            {
                return;                                       //TODO: Validate you require controller to move a npc
            }
            var act1 = p.Decode1();
            var act2 = p.Decode1();

            byte[] aMovePath = null;

            if (p.Available > 0)
            {
                aMovePath = p.DecodeBuffer(p.Available);
            }

            Field.Broadcast(CPacket.NpcMove(item, act1, act2, aMovePath));
        }
Ejemplo n.º 22
0
        private void DecodeAttackInfo(CInPacket p)
        {
            for (int i = 0; i < nMobCount; i++)
            {
                var info = new AttackEntry();

                info.dwMobID = p.Decode4();

                info.nHitAction  = p.Decode1();
                info.nForeAction = p.Decode1();                //  COutPacket::Encode1(&v468, v376->nForeAction & 0x7F | (v181 << 7));
                info.nFrameIdx   = p.Decode1();

                // v218 = CMob::GetCurTemplate(v378->pMob)
                //    && (v166 = CMob::GetTemplate(v378->pMob), v166 != CMob::GetCurTemplate(v378->pMob));
                // v167 = (_BYTE)v218 << 7;

                info.CalcDamageStatIndex = p.Decode1(); // COutPacket::Encode1(&v460, v168 & 0x7F | v167);

                p.Skip(8);                              // position info

                info.tDelay = p.Decode2();

                for (int j = 0; j < nDamagePerMob; j++)
                {
                    info.aDamage[j] = Math.Max(0, p.Decode4());

                    //Log.Debug($"[Damaging Mob] dwMobID: {info.dwMobID} aDamage: {info.aDamage[j]}");
                }

                p.Skip(4);                 // CMob::GetCrc

                aAttackInfo[i] = info;
            }
        }
Ejemplo n.º 23
0
        // actually in CUserLocal::TryDoingMonsterMagnet
        // but that function is only called by the active which has the name of this class
        //
        public static void Handle(int nSkillID, byte nSLV, Character c, CInPacket p)
        {
            //            COutPacket::COutPacket(&oPacket, 103);
            //            LOBYTE(v115) = 2;
            //            v81 = get_update_time();
            //            COutPacket::Encode4(&oPacket, v81);
            //            COutPacket::Encode4(&oPacket, v76->nSkillID);
            //            COutPacket::Encode1(&oPacket, nSLV);
            //            v82 = nRange;
            //            COutPacket::Encode4(&oPacket, nRange);
            //            for (k = 0; k < v82; ++k)
            //            {
            //                if (apMob.a[k].p)
            //                {
            //                    v84 = apMob.a[k].p;
            //                    v94 = (int*)v84->_ZtlSecureTear_m_dwMobID_CS;
            //                    v85 = _ZtlSecureFuse < unsigned long> (v84->_ZtlSecureTear_m_dwMobID, (unsigned int)v94);
            //        }
            //    else
            //    {
            //      v85 = 0;
            //    }
            //    COutPacket::Encode4(&oPacket, v85);
            //    v86 = anMobMove[k];
            //    v87 = v86 == 3 || v86 == 4;
            //    COutPacket::Encode1(&oPacket, v87);
            //  }
            //COutPacket::Encode1(&oPacket, v71->m_nMoveAction & 1);
            //  CClientSocket::SendPacket(TSingleton<CClientSocket>::ms_pInstance, &oPacket);

            var nCount = p.Decode4();
            var apMob  = new int[nCount];

            for (var i = 0; i > nCount; i++)
            {
                apMob[i] = p.Decode4();
                var anMobMove = p.Decode1(); // i dont think we need this???
            }

            var bLeft = p.Decode1() > 0;

            if (c.Skills.Cast(nSkillID, bLeft))
            {
                new UserEffectPacket(UserEffect.SkillUse)
                {
                    nSkillID = nSkillID,
                    nSLV     = nSLV,
                    bLeft    = bLeft,
                    dwMobId  = nCount > 0 ? apMob[0] : 0,                    // idk
                }.BroadcastEffect(c, false);

                foreach (var dwMobId in apMob)
                {
                    if (c.Field.Mobs.TryGetValue(dwMobId, out CMob cMob))
                    {
                        cMob.TryApplySkillDamageStatus(c, nSkillID, nSLV, 0);                         // todo configure this
                    }
                }
            }
        }
Ejemplo n.º 24
0
        public void OnUpdateRequest(CInPacket p)
        {
            var nReq = (MapTransferReq)p.Decode1();
            var bExt = p.Decode1() != 0;

            var pTransfer = bExt ? adwMapTransferEx : adwMapTransfer;

            switch (nReq)
            {
            case MapTransferReq.RegisterList:
            {
                var nFieldID = Parent.Field.MapId;
                if (Parent.Field.Template.HasTeleportItemLimit() || !AddLocation(pTransfer, nFieldID))
                {
                    Parent.SendPacket(CPacket.MapTransferResult(MapTransferRes.RegisterFail, bExt));
                }
                else
                {
                    Parent.SendPacket(CPacket.MapTransferResult(MapTransferRes.RegisterList, bExt, pTransfer));
                }
                break;
            }

            case MapTransferReq.DeleteList:
            {
                int nFieldID = p.Decode4();
                RemoveLocation(pTransfer, nFieldID);

                Parent.SendPacket(CPacket.MapTransferResult(MapTransferRes.DeleteList, bExt, pTransfer));
                break;
            }
            }
        }
Ejemplo n.º 25
0
        public static void IncCharSlotCount(WvsShopClient c, CInPacket p)
        {
            // validate packet length
            if (p.Available < 9)
            {
                return;
            }

            p.Decode1();
            var cashType    = p.Decode4();
            var commodityId = p.Decode4();

            //Log.Debug("CASH COMMODITY ID: " + commodityId);

            if (!c.Account.HasCash((CashType)cashType, 6900) ||
                (c.Account.AccountData.CharacterSlots + 3) >
#if DEBUG
                27
#else
                Constants.MaxCharSlot
#endif
                )
            {
                c.SendPacket(CPacket.CCashShop.RequestFailPacket(CashItemOps.CashItemRes_Buy_Failed, CashItemFailed.PurchaseLimitOver));
            }
Ejemplo n.º 26
0
        public static void Handle(int nSkillID, byte nSLV, Character c, CInPacket p)
        {
            // Recv [CP_UserSkillUseRequest] [67 00] [D0 B3 75 10] [A6 C7 C9 01] [01] [C0 F7 8D 00] [39 FE] [DF FF] [00]

            //COutPacket::COutPacket(&oPacket, 103);
            //v50 = 3;
            //v36 = get_update_time();
            //COutPacket::Encode4(&oPacket, v36);
            //COutPacket::Encode4(&oPacket, pSkill->nSkillID);
            //COutPacket::Encode1(&oPacket, nSLV);
            //COutPacket::Encode4(&oPacket, (unsigned int)cd);
            //COutPacket::Encode2(&oPacket, pt.x);
            //COutPacket::Encode2(&oPacket, pt.y);
            //COutPacket::Encode1(&oPacket, bLeft);
            //CClientSocket::SendPacket(TSingleton < CClientSocket >::ms_pInstance, &oPacket);

            var dwMobID = p.Decode4();
            var ptX     = p.Decode2();
            var ptY     = p.Decode2();
            var bLeft   = p.Decode1() > 0;

            if (c.Skills.Cast(nSkillID, bLeft))
            {
                new UserEffectPacket(UserEffect.SkillUse)
                {
                    nSkillID = nSkillID,
                    nSLV     = nSLV,
                    bLeft    = bLeft,
                    ptX      = ptX,
                    ptY      = ptY,
                }.BroadcastEffect(c, false);

                // TODO spawn monster lol
            }
        }
Ejemplo n.º 27
0
        public static void CharacterNameInUse(WvsLoginClient c, CInPacket p)
        {
            bool retVal   = false;
            var  charName = p.DecodeString();

            using (var conn = new NpgsqlConnection(Constants.DB_World0_ConString))
            {
                conn.Open();

                using (var cmd = new NpgsqlCommand($"SELECT * FROM {Constants.DB_All_World_Schema_Name}.characters WHERE name = (@name)", conn))
                {
                    cmd.Parameters.AddWithValue("name", charName);
                    using (var r = cmd.ExecuteReader())
                    {
                        while (r.Read())
                        {
                            retVal = true; // values to read means entry exists
                            break;
                        }
                    }
                }
            }

            c.SendPacket(CheckDuplicatedIDResult(charName, retVal));
        }
Ejemplo n.º 28
0
 public void OnQuickslotKeyMapped(CInPacket p)
 {
     for (int i = 0; i < 8; i++)
     {
         Insert(93 + 1, 8, p.Decode4());
     }
 }
Ejemplo n.º 29
0
        private void Handle_UserMeleeAttack(WvsGameClient c, CInPacket p)
        {
            var m_bCurFieldKey = p.Decode1();

            var atkInfo = MapleAttackNew.Parse(p, 0);
            var field   = c.GetCharField();

            //This pocket is not working ;( - rt if u cried
            var v1 = CPacket.CloseRangeAttack(c.Character.CharId, atkInfo);

            field.Broadcast(v1, c);

            for (int i = 0; i < atkInfo.nMobCount; i++)
            {
                var info = atkInfo.aAttackInfo[i];

                var mob = field.Mobs.Get(info.dwMobID);

                int dmg = 0;

                for (int j = 0; j < atkInfo.nDamagePerMob; j++)
                {
                    dmg += info.aDamage[j];
                }

                mob.CurHp -= dmg;

                if (mob.CurHp <= 0)
                {
                    field.RemoveMob(c, mob);
                }
            }
        }
Ejemplo n.º 30
0
        public void DeleteBlackList(CInPacket p)
        {
            var sNameToRemove = p.DecodeString();

            pBlackList.Remove(sNameToRemove);

            // do we respond with anything???
        }