public override void run()
 {
     try
     {
         if (_client == null)
         {
             return;
         }
         Account p = _client._player;
         if (p == null)
         {
             return;
         }
         PlayerMissions missions = p._mission;
         DBQuery        query    = new DBQuery();
         if (missions.getCard(actualMission) != cardIdx)
         {
             if (actualMission == 0)
             {
                 missions.card1 = cardIdx;
             }
             else if (actualMission == 1)
             {
                 missions.card2 = cardIdx;
             }
             else if (actualMission == 2)
             {
                 missions.card3 = cardIdx;
             }
             else if (actualMission == 3)
             {
                 missions.card4 = cardIdx;
             }
             query.AddQuery("card" + (actualMission + 1), cardIdx);
         }
         missions.selectedCard = cardFlags == 65535;
         if (missions.actualMission != actualMission)
         {
             query.AddQuery("actual_mission", actualMission);
             missions.actualMission = actualMission;
         }
         ComDiv.updateDB("player_missions", "owner_id", _client.player_id, query.GetTables(), query.GetValues());
     }
     catch (Exception ex)
     {
         SaveLog.fatal(ex.ToString());
         Printf.b_danger("[BASE_MISSION_ENTER_REC.run] Erro fatal!");
     }
 }
Ejemplo n.º 2
0
 public override void run()
 {
     try
     {
         if (this._client == null)
         {
             return;
         }
         Account player = this._client._player;
         if (player == null)
         {
             return;
         }
         PlayerMissions mission = player._mission;
         DBQuery        dbQuery = new DBQuery();
         if (mission.getCard(this.actualMission) != this.cardIdx)
         {
             if (this.actualMission == 0)
             {
                 mission.card1 = this.cardIdx;
             }
             else if (this.actualMission == 1)
             {
                 mission.card2 = this.cardIdx;
             }
             else if (this.actualMission == 2)
             {
                 mission.card3 = this.cardIdx;
             }
             else if (this.actualMission == 3)
             {
                 mission.card4 = this.cardIdx;
             }
             dbQuery.AddQuery("card" + (object)(this.actualMission + 1), (object)this.cardIdx);
         }
         mission.selectedCard = this.cardFlags == (int)ushort.MaxValue;
         if (mission.actualMission != this.actualMission)
         {
             dbQuery.AddQuery("actual_mission", (object)this.actualMission);
             mission.actualMission = this.actualMission;
         }
         ComDiv.updateDB("player_missions", "owner_id", (object)this._client.player_id, dbQuery.GetTables(), dbQuery.GetValues());
     }
     catch (Exception ex)
     {
         Logger.info("BASE_MISSION_ENTER_REC: " + ex.ToString());
     }
 }
Ejemplo n.º 3
0
        public override void run()
        {
            Account p = _client._player;

            if (p == null)
            {
                return;
            }
            PlayerConfig config = p._config;

            if (config == null)
            {
                return;
            }
            if ((type & 1) == 1)
            {
                PlayerManager.updateConfigs(query, config);
            }
            if ((type & 2) == 2)
            {
                query.AddQuery("keys", config.keys);
            }
            if ((type & 4) == 4)
            {
                PlayerManager.updateMacros(query, config, type);
            }
            ComDiv.updateDB("player_configs", "owner_id", _client.player_id, query.GetTables(), query.GetValues());
        }
Ejemplo n.º 4
0
 public override void RunImplement()
 {
     try
     {
         Logger.DebugPacket(GetType().Name, $"actualMission: {actualMission} cardIdx: {cardIdx} cardFlags: {cardFlags}");
         Account player = client.SessionPlayer;
         if (player == null || actualMission > 3 || cardIdx > 9)
         {
             return;
         }
         PlayerMissions missions = player.missions;
         using (DBQuery query = new DBQuery())
         {
             if (missions.GetCard(actualMission) != cardIdx)
             {
                 if (actualMission == 0)
                 {
                     missions.card1 = cardIdx;
                 }
                 else if (actualMission == 1)
                 {
                     missions.card2 = cardIdx;
                 }
                 else if (actualMission == 2)
                 {
                     missions.card3 = cardIdx;
                 }
                 else if (actualMission == 3)
                 {
                     missions.card4 = cardIdx;
                 }
                 query.AddQuery($"card{actualMission + 1}", cardIdx);
             }
             missions.selectedCard = cardFlags == 65535;
             if (missions.actualMission != actualMission)
             {
                 query.AddQuery("actual_mission", actualMission);
                 missions.actualMission = actualMission;
             }
             Utilities.UpdateDB("player_missions", "owner_id", player.playerId, query.GetTables(), query.GetValues());
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Ejemplo n.º 5
0
 public override void RunImplement()
 {
     try
     {
         Account  player = client.SessionPlayer;
         DateTime now    = DateTime.Now;
         if (player == null || (player.configs == null && !player.InsertConfig()) || (now - player.lastSaveConfigs).TotalSeconds < 1)
         {
             Logger.Warning($" [GAME] [{GetType().Name}] Ocorreu um problema ao salvar as configurações. PlayerId: {player.playerId}");
             return;
         }
         if (configs.blood > 3 || configs.sight > 3 || configs.hand > 1 || configs.config > 63 || configs.audioEnable > 7 || configs.audio > 100 || configs.music > 100 || configs.fov < 35 || configs.fov > 80 || configs.sensibilidade < 10 || configs.sensibilidade > 120 || configs.invertedMouse > 1 || (configs.messageInvitation != 0 && configs.messageInvitation != 16 && configs.messageInvitation != 32) || (configs.chatPrivate != 0 && configs.chatPrivate != 1 && configs.chatPrivate != 16 && configs.chatPrivate != 17) || configs.macros > 31 || configs.macro_1.Length > 58 || configs.macro_2.Length > 58 || configs.macro_3.Length > 58 || configs.macro_4.Length > 58 || configs.macro_5.Length > 58)
         {
             Logger.Warning($" [GAME] [{GetType().Name}] Dados das configurações recebidas estão incorretos. PlayerId: {player.playerId}");
             return;
         }
         using (DBQuery query = new DBQuery())
         {
             if ((type & 1) == 1)
             {
                 player.UpdateConfigs(query, configs);
             }
             if ((type & 2) == 2)
             {
                 query.AddQuery("keys", configs.keys);
             }
             if ((type & 4) == 4)
             {
                 player.UpdateMacros(query, configs, type);
             }
             Utilities.UpdateDB("player_configs", "owner_id", player.playerId, query.GetTables(), query.GetValues());
         }
         player.configs         = configs;
         player.lastSaveConfigs = now;
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Ejemplo n.º 6
0
        private void FreepassEffect(Account p,SLOT slot,Room room,bool isBotMode)
        {
            DBQuery dbQuery = new DBQuery();

            if (p._bonus.freepass == 0 || p._bonus.freepass == 1 && room._channelType == 4)
            {
                if (isBotMode || slot.state < SLOT_STATE.BATTLE_READY)
                {
                    return;
                }
                if (p._gp > 0)
                {
                    p._gp -= 200;
                    if (p._gp < 0)
                    {
                        p._gp = 0;
                    }
                    dbQuery.AddQuery("gp",(object)p._gp);
                }
                dbQuery.AddQuery("escapes",(object)++p._statistic.escapes);
            }
            else
            {
                if (room._state != RoomState.Battle)
                {
                    return;
                }
                int num1 = 0;
                int num2 = 0;
                int num3;
                int num4;
                if (isBotMode)
                {
                    int num5 = (int)room.IngameAiLevel * (150 + slot.allDeaths);
                    if (num5 == 0)
                    {
                        ++num5;
                    }
                    int num6 = slot.Score / num5;
                    num3 = num2 + num6;
                    num4 = num1 + num6;
                }
                else
                {
                    int num5 = slot.allKills != 0 || slot.allDeaths != 0 ? (int)slot.inBattleTime(DateTime.Now) : 0;
                    if (room.room_type == (byte)2 || room.room_type == (byte)4)
                    {
                        num4 = (int)((double)slot.Score + (double)num5 / 2.5 + (double)slot.allDeaths * 2.2 + (double)(slot.objetivos * 20));
                        num3 = (int)((double)slot.Score + (double)num5 / 3.0 + (double)slot.allDeaths * 2.2 + (double)(slot.objetivos * 20));
                    }
                    else
                    {
                        num4 = (int)((double)slot.Score + (double)num5 / 2.5 + (double)slot.allDeaths * 1.8 + (double)(slot.objetivos * 20));
                        num3 = (int)((double)slot.Score + (double)num5 / 3.0 + (double)slot.allDeaths * 1.8 + (double)(slot.objetivos * 20));
                    }
                }
                p._exp += ConfigGS.maxBattleXP < num4 ? ConfigGS.maxBattleXP : num4;
                p._gp  += ConfigGS.maxBattleGP < num3 ? ConfigGS.maxBattleGP : num3;
                if (num3 > 0)
                {
                    dbQuery.AddQuery("gp",(object)p._gp);
                }
                if (num4 > 0)
                {
                    dbQuery.AddQuery("exp",(object)p._exp);
                }
            }
            ComDiv.updateDB("accounts","player_id",(object)p.player_id,dbQuery.GetTables(),dbQuery.GetValues());
        }
Ejemplo n.º 7
0
 private void FreepassEffect(Account player, Slot slot, Room room, bool isBotMode)
 {
     using (DBQuery query = new DBQuery())
     {
         if (player.bonus.freepass == 0 || player.bonus.freepass == 1 && room.channelType == 4)
         {
             if (isBotMode || slot.state < SlotStateEnum.BATTLE_READY)
             {
                 return;
             }
             if (player.gold >= 200)
             {
                 player.gold -= 200;
                 query.AddQuery("gold", player.gold);
             }
             query.AddQuery("fights_escapes", ++player.statistics.escapes);
         }
         else// if (ch._type != 4)
         {
             if (room.state != RoomStateEnum.Battle)
             {
                 return;
             }
             int xp = 0, gold = 0;
             if (isBotMode)
             {
                 int level = room.IngameAiLevel * (150 + slot.allDeaths);
                 if (level == 0)
                 {
                     level++;
                 }
                 int reward = slot.score / level;
                 gold += reward;
                 xp   += reward;
             }
             else
             {
                 int timePlayed = slot.allKills == 0 && slot.allDeaths == 0 ? 0 : (int)slot.InBattleTime(DateTime.Now);
                 if (room.mode == RoomTypeEnum.Destruction || room.mode == RoomTypeEnum.Suppression)
                 {
                     xp   = (int)(slot.score + (timePlayed / 2.5) + (slot.allDeaths * 2.2) + (slot.objetivos * 20));
                     gold = (int)(slot.score + (timePlayed / 3.0) + (slot.allDeaths * 2.2) + (slot.objetivos * 20));
                 }
                 else
                 {
                     xp   = (int)(slot.score + (timePlayed / 2.5) + (slot.allDeaths * 1.8) + (slot.objetivos * 20));
                     gold = (int)(slot.score + (timePlayed / 3.0) + (slot.allDeaths * 1.8) + (slot.objetivos * 20));
                 }
             }
             xp   = xp > Settings.MaxBattleExp ? Settings.MaxBattleExp : xp;
             gold = gold > Settings.MaxBattleGold ? Settings.MaxBattleGold : gold;
             if ((player.exp + xp) <= 999999999)
             {
                 player.exp += xp;
             }
             if ((player.gold + gold) <= 999999999)
             {
                 player.gold += gold;
             }
             if (xp > 0)
             {
                 query.AddQuery("exp", player.exp);
             }
             if (gold > 0)
             {
                 query.AddQuery("gold", player.gold);
             }
         }
         Utilities.UpdateDB("accounts", "id", player.playerId, query.GetTables(), query.GetValues());
     }
 }
        private void FreepassEffect(Account p,SLOT slot,Room room,bool isBotMode)
        {
            DBQuery query = new DBQuery();

            if (p._bonus.freepass == 0 || p._bonus.freepass == 1 && room._channelType == 4)
            {
                if (isBotMode || slot.state < SLOT_STATE.BATTLE_READY)
                {
                    return;
                }

                if (p._gp > 0)
                {
                    p._gp -= 200;
                    if (p._gp < 0)
                    {
                        p._gp = 0;
                    }
                    query.AddQuery("gp",p._gp);
                }
                query.AddQuery("escapes",++p._statistic.escapes);
            }
            else// if (ch._type != 4)
            {
                if (room._state != RoomState.Battle)
                {
                    return;
                }
                int xp = 0,gp = 0;
                if (isBotMode)
                {
                    int level = room.IngameAiLevel * (150 + slot.allDeaths);
                    if (level == 0)
                    {
                        level++;
                    }
                    int reward = (slot.Score / level);
                    gp += reward;
                    xp += reward;
                }
                else
                {
                    int timePlayed = slot.allKills == 0 && slot.allDeaths == 0 ? 0 : (int)slot.inBattleTime(DateTime.Now);
                    if (room.room_type == 2 || room.room_type == 4)
                    {
                        xp = (int)(slot.Score + (timePlayed / 2.5) + (slot.allDeaths * 2.2) + (slot.objetivos * 20));
                        gp = (int)(slot.Score + (timePlayed / 3.0) + (slot.allDeaths * 2.2) + (slot.objetivos * 20));
                    }
                    else
                    {
                        xp = (int)(slot.Score + (timePlayed / 2.5) + (slot.allDeaths * 1.8) + (slot.objetivos * 20));
                        gp = (int)(slot.Score + (timePlayed / 3.0) + (slot.allDeaths * 1.8) + (slot.objetivos * 20));
                    }
                }
                p._exp += ConfigGS.maxBattleXP < xp ? ConfigGS.maxBattleXP : xp;
                p._gp  += ConfigGS.maxBattleGP < gp ? ConfigGS.maxBattleGP : gp;
                if (gp > 0)
                {
                    query.AddQuery("gp",p._gp);
                }
                if (xp > 0)
                {
                    query.AddQuery("exp",p._exp);
                }
            }
            ComDiv.updateDB("contas","player_id",p.player_id,query.GetTables(),query.GetValues());
        }