public void SellWood()
 {
     if (wareHouse != null && worldData != null)
     {
         if (wareHouse.woodStored >= worldData.woodVolume)
         {
             playerInfo.AddMoney(sellPriceWareHouse.sellPriceWood);
             wareHouse.RemoveWood();
         }
     }
 }
Example #2
0
    public void RentProperty(PlayerInfo player)
    {
        Property   property    = properties[player.x, player.y];
        PlayerInfo playerOwner = property.owner;

        playerOwner.AddMoney(property.rent);
        player.DisccountMoney(property.calcRent());
    }
Example #3
0
    public void ApplyRewardToPlayers()
    {
        foreach (var player in PlayerManager.Instance.Players)
        {
            PlayerInfo   info   = player.Value.info;
            PlayerRecord record = m_RecordMap[player.Key];

            info.AddExp(record.Exp);
            info.AddMoney(record.Money);

            MissionReward missionReward = CaculateAllMissionReward();
            info.AddExp(missionReward.EXP);
            info.AddMoney(missionReward.Money);

            PlayerManager.Instance.SavePlayerInfo(player.Key);
        }

        Destroy(this.gameObject);
    }
Example #4
0
        public void CMD_GiveMoney(Client client, Client player, double amount)
        {
            if (!client.HasData("ID"))
            {
                return;
            }

            PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client);
            PlayerInfo pInfo      = PlayerHelper.GetPlayerStats(player);

            if (pInfo == null)
            {
                client.SendNotification($"Le joueur {player.Name} n'a pas pu être trouvé.");
                return;
            }


            PlayerInfo otherInfo = Database.GetById <PlayerInfo>(pInfo._id);

            if (otherInfo == null)
            {
                Console.WriteLine($"{pInfo.vorname} {pInfo.nachname} n'a pas de table PlayerInfo!");
                return;
            }

            bool result = playerInfo.SubMoney(amount);

            if (!result)
            {
                client.SendNotification("~r~Vous ne possédez pas cet argent!");
                return;
            }

            otherInfo.AddMoney(amount);

            Database.Update(otherInfo);
            Database.Update(playerInfo);

            client.SendNotification($"Vous avez donné au joueur { player.Name} ~g~{amount}$ ~w~avec succes!");
            player.SendNotification($"Vous avez reçu ~g~{amount}~w~ de {client.Name} !");
            EventTriggers.Update_Money(client);

            Client other_player = NAPI.Player.GetPlayerFromName(player.Name);

            if (other_player == null)
            {
                return;
            }

            EventTriggers.Update_Money(other_player);
        }
Example #5
0
        public void CMD_GiveMoney(Client client, Client player, double amount)
        {
            if (!client.HasData("ID"))
            {
                return;
            }

            PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client);
            PlayerInfo pInfo      = PlayerHelper.GetPlayerStats(player);

            if (pInfo == null)
            {
                client.SendNotification($"Spieler {player.Name} konnte nicht gefunden werden.");
                return;
            }


            PlayerInfo otherInfo = Database.GetById <PlayerInfo>(pInfo._id);

            if (otherInfo == null)
            {
                Console.WriteLine($"{pInfo.vorname} {pInfo.nachname} besitzt keine PlayerInfo Tabelle!");
                return;
            }

            bool result = playerInfo.SubMoney(amount);

            if (!result)
            {
                client.SendNotification("~r~Dieses Geld besitzt du nicht!");
                return;
            }

            otherInfo.AddMoney(amount);

            Database.Update(otherInfo);
            Database.Update(playerInfo);

            client.SendNotification($"Du hast dem Spieler {player.Name} erfolgreich ~g~{amount}$ ~w~gegeben!");
            player.SendNotification($"Du hast ~g~{amount}~w~ von {client.Name} erhalten!");
            EventTriggers.Update_Money(client);

            Client other_player = NAPI.Player.GetPlayerFromName(player.Name);

            if (other_player == null)
            {
                return;
            }

            EventTriggers.Update_Money(other_player);
        }
    public PlayerInfo LoadPlayerInfo(DataSaver data)
    {
        PlayerInfo player = new PlayerInfo();

        player.SetUsername(data.Username);
        player.AddExp(data.Exp);
        player.AddMoney(data.Money);
        player.RefreshEquipWeapon(data.Weapons);
        player.RefreshEquipStratagem(data.Stratagems);
        player.RefreshEquipGrenade(data.Grenades);
        player.RefreshUnlockedWeapons(data.UnlockedWeapons);
        player.RefreshUnlockedStratagems(data.UnlockedStratagems);

        return(player);
    }
Example #7
0
 public void SellOil()
 {
     if (refinery != null && worldData != null)
     {
         if (refinery.oilStored >= worldData.oilVolume)
         {
             playerInfo.AddMoney(sellPriceRefinery.sellPriceOil);
             refinery.RemoveOil();
         }
     }
     else
     {
         Debug.Log("failed to selloil in sellresourcerefinery");
     }
 }
Example #8
0
        public void CMD_UnRent(Client client)
        {
            PlayerInfo pInfo = PlayerHelper.GetPlayerStats(client);

            Vehicle rent = client.GetData("RentVehicle");

            if (client.HasData("RentVehicle"))
            {
                if (client.IsInVehicle)
                {
                    if (client.Position.DistanceTo2D(rent.Position) <= 0.1)
                    {
                        if (NAPI.Vehicle.GetVehicleHealth(client) >= 800)
                        {
                            Vehicle RentVehicle = client.GetData("RentVehicle");
                            RentVehicle.Delete();
                            client.SendChatMessage("Dein Mietvertrag wurde gekündigt. Du erhälst ~g~75$~w~ zurück!");
                            client.SendNotification("Du hast ~g~75$~w~ erhalten.");
                            client.ResetData("RentVehicle");
                            pInfo.AddMoney(75);
                            Database.Update(pInfo);
                            EventTriggers.Update_Money(client);
                        }
                        else if (NAPI.Vehicle.GetVehicleHealth(client) <= 800)
                        {
                            Vehicle RentVehicle = client.GetData("RentVehicle");
                            RentVehicle.Delete();
                            client.SendChatMessage("Dein Fahrzeug hat zu viele beschädigungen. Du erhälst kein Geld zurück!");
                            client.ResetData("RentVehicle");
                        }
                    }
                    else
                    {
                        client.SendNotification("Du befindest dich nicht auf dem Roller!");
                    }
                }
                else
                {
                    client.SendNotification("Du befindest dich nicht auf dem Roller!");
                }
            }
            else //if (client.HasData("RentVehicle") == false)
            {
                client.SendNotification("~r~Du besitzt kein Mietfahrzeug!");
            }
        }
Example #9
0
        public void CMD_setmoney(Client client, Client player, double amount)
        {
            if (!client.HasData("ID"))
            {
                return;
            }

            PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client);
            PlayerInfo pInfo      = PlayerHelper.GetPlayerStats(player);

            if (!AdminSystem.HasRank(client, 2))
            {
                client.SendNotification("~r~Du hast dazu keine Berechtigung!");
                return;
            }

            client.SendNotification($"Du hast dem Spieler ~y~{player.Name}~w~ erfolgreich ~g~{amount}$~w~ gegeben!");
            player.SendNotification($"Du hast ~g~{amount}$~w~ erhalten!");

            pInfo.AddMoney(amount);

            Database.Update(pInfo);
            EventTriggers.Update_Money(player);
        }
Example #10
0
        public void CMD_setmoney(Client client, Client player, double amount)
        {
            if (!client.HasData("ID"))
            {
                return;
            }

            PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client);
            PlayerInfo pInfo      = PlayerHelper.GetPlayerStats(player);

            if (!AdminSystem.HasRank(client, 2))
            {
                client.SendNotification("~r~Vous n'avez aucune autorisation!");
                return;
            }

            client.SendNotification($"Vous avez donné à ~y~{player.Name}~w~  ~g~{amount}$~w~ $!");
            player.SendNotification($"Vous avez obtenu ~g~{amount}$~w~ ");

            pInfo.AddMoney(amount);

            Database.Update(pInfo);
            EventTriggers.Update_Money(player);
        }
Example #11
0
 public void GiveCenterMoney2Player(PlayerInfo player)
 {
     player.AddMoney(CenterMoney);
     CenterMoney = 0;
 }