示例#1
0
        private float GetWorthTarget(PlayerServer player)
        {
            var attCosts = player.CostWorldObjects(Mail.PlaceServerId);
            var attCost  = attCosts.MarketValue + attCosts.MarketValuePawn;

            return(attCost);
        }
示例#2
0
        public string New(PlayerServer player, PlayerServer hostPlayer, AttackInitiatorToSrv fromClient, bool testMode)
        {
            if (ServerManager.ServerSettings.GeneralSettings.EnablePVP)
            {
                return("PVP online disable on this server");
            }
            if (!player.Online || !hostPlayer.Online)
            {
                Loger.Log($"Server AttackServer {Attacker.Public.Login} -> {Host.Public.Login} canceled: Attack not possible: player offline");
                return("Attack not possible: player offline");
            }
            var err = AttackUtils.CheckPossibilityAttack(player, hostPlayer, fromClient.InitiatorPlaceServerId, fromClient.HostPlaceServerId
                                                         , ServerManager.ServerSettings.ProtectingNovice);

            if (err != null)
            {
                Loger.Log($"Server AttackServer {Attacker.Public.Login} -> {Host.Public.Login} canceled: {err}");
                return(err);
            }

            TestMode               = testMode;
            Attacker               = player;
            Host                   = hostPlayer;
            Attacker.AttackData    = this;
            Host.AttackData        = this;
            HostPlaceServerId      = fromClient.HostPlaceServerId;
            InitiatorPlaceServerId = fromClient.InitiatorPlaceServerId;
            var data = Repository.GetData;
            var woip = data.WorldObjects.FirstOrDefault(wo => wo.ServerId == InitiatorPlaceServerId);

            if (woip != null)
            {
                InitiatorPlaceTile = woip.Tile;
            }

            NewPawns        = new List <ThingEntry>();
            NewPawnsId      = new List <int>();
            NewThings       = new List <ThingTrade>();
            NewThingsId     = new List <int>();
            NewCorpses      = new List <AttackCorpse>();
            Delete          = new List <int>();
            UpdateState     = new Dictionary <int, AttackThingState>();
            UpdateCommand   = new Dictionary <int, AttackPawnCommand>();
            NeedNewThingIDs = new HashSet <int>();

            CreateTime       = DateTime.UtcNow;
            AttackUpdateTick = 0;

            if (!TestMode)
            {
                Host.Public.LastPVPTime = DateTime.UtcNow;
            }

            Loger.Log($"Server AttackServer {Attacker.Public.Login} -> {Host.Public.Login} New");
            return(null);
        }
示例#3
0
        public string New(PlayerServer player, PlayerServer hostPlayer, AttackInitiatorToSrv fromClient)
        {
            Attacker               = player;
            Host                   = hostPlayer;
            Attacker.AttackData    = this;
            Host.AttackData        = this;
            InitiatorPlaceServerId = fromClient.InitiatorPlaceServerId;
            HostPlaceServerId      = fromClient.HostPlaceServerId;

            NewPawns      = new List <ThingEntry>();
            NewPawnsId    = new List <int>();
            NewThings     = new List <ThingEntry>();
            NewThingsId   = new List <int>();
            Delete        = new List <int>();
            UpdateState   = new Dictionary <int, AttackThingState>();
            UpdateCommand = new Dictionary <int, AttackPawnCommand>();
            return(null);
        }