Exemple #1
0
        //Process SaveMob (SaveUser)
        public static DBResult Exec_MSG_DBSaveMob(DBController gs, pServer GameServer)
        {
            _MSG_DBSaveMob sm = W2Marshal.GetStructure <_MSG_DBSaveMob>(GameServer.RecvPacket.RawBuffer);

            int Idx = gs.GetIndex(sm.Header.ClientId);

            int Slot = gs.AccountList[Idx].Slot;

            if (Slot < 0 || Slot >= 4)
            {
                W2Log.Write(String.Format("err,savemob1 {0} {1} {2} {3} {4}", sm.Header.ClientId, Slot, sm.Slot, gs.AccountList[Idx].Account.Info.AccountName, sm.Accountname.Value));
                return(DBResult.NO_ERROR);
            }

            if (Slot != sm.Slot)
            {
                W2Log.Write(String.Format("err,savemob2 {0} {1} {2} {3} {4}", sm.Header.ClientId, Slot, sm.Slot, gs.AccountList[Idx].Account.Info.AccountName, sm.Accountname.Value));
                //[19:52:28] err,savemob2 2 0 -1 wedbr123 wedbr123

                return(DBResult.NO_ERROR);
            }

            if (gs.AccountList[Idx].State == EServerStatus.CLOSED)
            {
                W2Log.Write(String.Format("err,savemob3 {0} {1} {2} {3} {4}", sm.Header.ClientId, Slot, sm.Slot, gs.AccountList[Idx].Account.Info.AccountName, sm.Accountname.Value));
                return(DBResult.NO_ERROR);
            }

            //


            gs.AccountList[Idx].Account.Donate         = sm.Donate;
            gs.AccountList[Idx].Account.Mob[Slot]      = sm.Mob;
            gs.AccountList[Idx].Account.MobExtra[Slot] = sm.Extra;
            gs.AccountList[Idx].Account.other          = sm.Other;

            gs.AccountList[Idx].Account.Affects[Slot].Affects = sm.Affects;

            gs.AccountList[Idx].Account.Cargo = sm.Cargo;
            gs.AccountList[Idx].Account.Skillbar[Slot].ShortSkill = sm.ShortSkill;
            gs.AccountList[Idx].Account.Coin = sm.Coin;


            gs.SaveAccount(sm.Header.ClientId);



            return(DBResult.NO_ERROR);
        }
Exemple #2
0
        //Process SaveMob (CloseUser)
        public static DBResult Exec_MSG_SavingQuit(DBController gs, pServer GameServer)
        {
            _MSG_DBSaveMob sm = W2Marshal.GetStructure <_MSG_DBSaveMob>(GameServer.RecvPacket.RawBuffer);

            int Idx = gs.GetIndex(sm.Header.ClientId);


            int Slot = gs.AccountList[Idx].Slot;

            if (Slot < 0 || Slot >= 4)
            {
                W2Log.Write(String.Format("err,savenquit1 {0} {1} {2} {3} {4}", sm.Header.ClientId, Slot, sm.Slot, gs.AccountList[Idx].Account.Info.AccountName, sm.Accountname.Value));
                return(DBResult.NO_ERROR);
            }

            if (Slot != sm.Slot)
            {
                W2Log.Write(String.Format("err,savenquit2 {0} {1} {2} {3} {4}", sm.Header.ClientId, Slot, sm.Slot, gs.AccountList[Idx].Account.Info.AccountName, sm.Accountname.Value));
                return(DBResult.NO_ERROR);
            }

            if (gs.AccountList[Idx].State == EServerStatus.CLOSED)
            {
                W2Log.Write(String.Format("err,savenquit3 {0} {1} {2} {3} {4}", sm.Header.ClientId, Slot, sm.Slot, gs.AccountList[Idx].Account.Info.AccountName, sm.Accountname.Value));
                return(DBResult.NO_ERROR);
            }


            gs.AccountList[Idx].Account.Donate                    = sm.Donate;
            gs.AccountList[Idx].Account.Mob[Slot]                 = sm.Mob;
            gs.AccountList[Idx].Account.MobExtra[Slot]            = sm.Extra;
            gs.AccountList[Idx].Account.other                     = sm.Other;
            gs.AccountList[Idx].Account.Affects[Slot].Affects     = sm.Affects;
            gs.AccountList[Idx].Account.Cargo                     = sm.Cargo;
            gs.AccountList[Idx].Account.Skillbar[Slot].ShortSkill = sm.ShortSkill;
            gs.AccountList[Idx].Account.Coin = sm.Coin;


            if (gs.SaveAccount(sm.Header.ClientId))
            {
                W2Log.Write(String.Format("account logout: {0}/{1}", Idx, sm.Accountname.Value), ELogType.CRITICAL_ERROR);
                gs.RemoveAccountList(Idx);
                gs.Server.SendSignal(sm.Header.ClientId, BaseDef._MSG_DBCNFAccountLogOut);
                return(DBResult.NO_ERROR);
            }

            return(DBResult.NO_ERROR);
        }