From d0e4627176b8017079bdcfe9c07d9f7e79828578 Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Wed, 10 Jan 2018 20:52:55 -0500
Subject: [PATCH 001/457] Gitignore and startup args (#1)
Gitignore and args
---
.gitignore | 261 ++++++++++++++++++
.../Perpetuum.Server.csproj.user | 12 +-
2 files changed, 272 insertions(+), 1 deletion(-)
create mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..3c4efe206
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,261 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
\ No newline at end of file
diff --git a/src/Perpetuum.Server/Perpetuum.Server.csproj.user b/src/Perpetuum.Server/Perpetuum.Server.csproj.user
index a15ccb472..6f4cef0a6 100644
--- a/src/Perpetuum.Server/Perpetuum.Server.csproj.user
+++ b/src/Perpetuum.Server/Perpetuum.Server.csproj.user
@@ -1,9 +1,19 @@
- d:\work\server\genxy
+ C:\PerpetuumServer\data
a:\work\server\genxy
+
+ publish\
+
+
+
+
+
+ en-US
+ false
+
\ No newline at end of file
From 60745d4973e4e3cbf39bdc7ed5e1fa5db6c1f739 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Wed, 10 Jan 2018 21:19:14 -0500
Subject: [PATCH 002/457] Fix for field terminals.
---
src/Perpetuum.RequestHandlers/GetRobotInfo.cs | 74 ++++++++++---------
1 file changed, 38 insertions(+), 36 deletions(-)
diff --git a/src/Perpetuum.RequestHandlers/GetRobotInfo.cs b/src/Perpetuum.RequestHandlers/GetRobotInfo.cs
index 9fca34eb9..77dfc3360 100644
--- a/src/Perpetuum.RequestHandlers/GetRobotInfo.cs
+++ b/src/Perpetuum.RequestHandlers/GetRobotInfo.cs
@@ -24,55 +24,57 @@ public GetRobotInfo(IZoneManager zoneManager,RobotHelper robotHelper)
public void HandleRequest(IRequest request)
{
- TransactionScope scope = null;
- try
+ // make sure the transaction scope is disposed of properly.
+ using (TransactionScope scope = Db.CreateTransaction())
{
- if (TryGetRobotFromZone(request, out Robot robot))
+ try
{
- scope = Db.CreateTransaction();
- robot.EnlistTransaction();
- }
- else
- {
- var robotEid = request.Data.GetOrDefault(k.robotEID);
- robot = _robotHelper.LoadRobotForCharacter(robotEid,request.Session.Character);
- }
+ if (TryGetRobotFromZone(request, out Robot robot))
+ {
+ robot.EnlistTransaction();
+ }
+ else
+ {
+ var robotEid = request.Data.GetOrDefault(k.robotEID);
+ robot = _robotHelper.LoadRobotForCharacter(robotEid, request.Session.Character);
+ }
- if (robot == null)
- throw new PerpetuumException(ErrorCodes.RobotNotFound);
+ if (robot == null)
+ throw new PerpetuumException(ErrorCodes.RobotNotFound);
- if ( !robot.IsSingleAndUnpacked)
- throw new PerpetuumException(ErrorCodes.RobotMustbeSingleAndNonRepacked);
+ if (!robot.IsSingleAndUnpacked)
+ throw new PerpetuumException(ErrorCodes.RobotMustbeSingleAndNonRepacked);
- if (ForFitting)
- {
- robot.CheckOwnerOnlyCharacterAndThrowIfFailed(request.Session.Character);
- }
- else
- {
- robot.CheckOwnerCharacterAndCorporationAndThrowIfFailed(request.Session.Character);
- }
+ if (ForFitting)
+ {
+ robot.CheckOwnerOnlyCharacterAndThrowIfFailed(request.Session.Character);
+ }
+ else
+ {
+ robot.CheckOwnerCharacterAndCorporationAndThrowIfFailed(request.Session.Character);
+ }
- switch (robot.GetOrLoadParentEntity())
- {
- case DefaultSystemContainer _:
- case RobotInventory _ when ForFitting:
- case CorporateHangar _ when ForFitting:
+ switch (robot.GetOrLoadParentEntity())
{
- throw new PerpetuumException(ErrorCodes.AccessDenied);
+ case DefaultSystemContainer _:
+ case RobotInventory _ when ForFitting:
+ case CorporateHangar _ when ForFitting:
+ {
+ throw new PerpetuumException(ErrorCodes.AccessDenied);
+ }
}
- }
- var result = new Dictionary
+ var result = new Dictionary
{
{ k.robot,robot.ToDictionary() }
};
- Message.Builder.FromRequest(request).WithData(result).WrapToResult().WithEmpty().Send();
- }
- finally
- {
- scope?.Complete();
+ Message.Builder.FromRequest(request).WithData(result).WrapToResult().WithEmpty().Send();
+ }
+ finally
+ {
+ scope?.Complete();
+ }
}
}
From ce1cce08fc1bd86b3e99b62ea0f603ad6aaf3400 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Thu, 11 Jan 2018 00:02:55 -0500
Subject: [PATCH 003/457] fix remote market server error
---
.../Services/MarketEngine/MarketOrderRepository.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs b/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs
index 6d78486ca..f70962737 100644
--- a/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs
+++ b/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs
@@ -38,7 +38,7 @@ public static class MarketOrderRepositoryExtensions
public class MarketOrderRepository : IMarketOrderRepository
{
- private const string ORDER_COLUMNS = "marketitemid, marketeid, itemeid, itemdefinition, submittereid, submitted, duration, isSell, price, quantity, usecorporationwallet, isvendoritem, formembersof FROM marketitems ";
+ private const string ORDER_COLUMNS = "marketitems.marketitemid, marketitems.marketeid, marketitems.itemeid, marketitems.itemdefinition, marketitems.submittereid, marketitems.submitted, marketitems.duration, marketitems.isSell, marketitems.price, marketitems.quantity, marketitems.usecorporationwallet, marketitems.isvendoritem, marketitems.formembersof FROM marketitems ";
private const string ORDER_SELECT = "SELECT " + ORDER_COLUMNS;
private const string TOP1_SELECT = "SELECT TOP (1) " + ORDER_COLUMNS;
private readonly MarketOrder.Factory _marketOrderFactory;
@@ -155,7 +155,9 @@ public IEnumerable GetExpiredOrders(TimeSpan duration)
public IEnumerable GetAllByDefinition(int definition)
{
- const string cmd = ORDER_SELECT + @"where itemdefinition = @definition";
+ // this is an example as to why we should not have a table that references itself.
+ // the purpose of this is to not return market items on disabled zones.
+ const string cmd = ORDER_SELECT + @"INNER JOIN entities as childentity on (marketitems.marketeid=childentity.eid) INNER JOIN entities parent on (childentity.eid=parent.eid) INNER JOIN zoneentities on (parent.parent=zoneentities.eid) INNER JOIN zones on (zoneentities.zoneid=zones.id) where itemdefinition = @definition and zones.enabled=1";
return Db.Query().CommandText(cmd)
.SetParameter("@definition", definition)
From 28c72664db0589f5aa33b5a193fdfe3b9e9e8b0a Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Thu, 11 Jan 2018 09:08:01 -0500
Subject: [PATCH 004/457] gives player equal syndicate protection and molecular
instability when teleporting.
---
src/Perpetuum/Players/Player.cs | 6 ++++++
.../Zones/Teleporting/Strategies/TeleportWithinZone.cs | 9 ++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/Perpetuum/Players/Player.cs b/src/Perpetuum/Players/Player.cs
index 979896ad2..7a80d7bbb 100644
--- a/src/Perpetuum/Players/Player.cs
+++ b/src/Perpetuum/Players/Player.cs
@@ -318,6 +318,12 @@ public void ApplyInvulnerableEffect()
ApplyEffect(builder);
}
+ public void RemoveInvulnerableEffect()
+ {
+ EffectHandler.RemoveEffectsByType(EffectType.effect_invulnerable);
+ }
+
+
public void ApplyTeleportSicknessEffect()
{
var zone = Zone;
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs
index 3aa88de06..087c79cff 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs
@@ -53,8 +53,15 @@ public Task DoTeleportAsync(Player player)
player.AddToZone(zone,validPosition,ZoneEnterType.LocalTeleport);
player.SendInitSelf();
- if ( ApplyTeleportSickness )
+ if (ApplyTeleportSickness)
+ {
player.ApplyTeleportSicknessEffect();
+ }
+ if (ApplyInvulnerable)
+ {
+ player.RemoveInvulnerableEffect(); // remove previous effect.
+ player.ApplyInvulnerableEffect(); // re-add effect to restart counter.
+ }
// mozoghat, fade out
player.States.InMoveable = false;
From ea04e4c1411bce7fb6715d187276eb811dc2c52a Mon Sep 17 00:00:00 2001
From: mikejeffers
Date: Thu, 11 Jan 2018 20:15:15 -0500
Subject: [PATCH 005/457] Tweak syndicate protection to be 25% less than
instability
---
src/Perpetuum/Players/Player.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Perpetuum/Players/Player.cs b/src/Perpetuum/Players/Player.cs
index 7a80d7bbb..68472e8e5 100644
--- a/src/Perpetuum/Players/Player.cs
+++ b/src/Perpetuum/Players/Player.cs
@@ -315,6 +315,7 @@ public void SendModuleProcessError(Module module, ErrorCodes error)
public void ApplyInvulnerableEffect()
{
var builder = NewEffectBuilder().SetType(EffectType.effect_invulnerable);
+ builder.WithDurationModifier(0.75); //Reduce span of syndicate protection
ApplyEffect(builder);
}
From 3f8849c07949bd90e9e8e8d822426feabab76386 Mon Sep 17 00:00:00 2001
From: LoyalServant
Date: Thu, 11 Jan 2018 20:26:03 -0500
Subject: [PATCH 006/457] Fix for field terminals. (#2)
* Fix for field terminals.
* fix remote market server error
* gives player equal syndicate protection and molecular instability when teleporting.
* Tweak syndicate protection to be 25% less than instability
---
src/Perpetuum.RequestHandlers/GetRobotInfo.cs | 74 ++++++++++---------
src/Perpetuum/Players/Player.cs | 7 ++
.../MarketEngine/MarketOrderRepository.cs | 6 +-
.../Strategies/TeleportWithinZone.cs | 9 ++-
4 files changed, 57 insertions(+), 39 deletions(-)
diff --git a/src/Perpetuum.RequestHandlers/GetRobotInfo.cs b/src/Perpetuum.RequestHandlers/GetRobotInfo.cs
index 9fca34eb9..77dfc3360 100644
--- a/src/Perpetuum.RequestHandlers/GetRobotInfo.cs
+++ b/src/Perpetuum.RequestHandlers/GetRobotInfo.cs
@@ -24,55 +24,57 @@ public GetRobotInfo(IZoneManager zoneManager,RobotHelper robotHelper)
public void HandleRequest(IRequest request)
{
- TransactionScope scope = null;
- try
+ // make sure the transaction scope is disposed of properly.
+ using (TransactionScope scope = Db.CreateTransaction())
{
- if (TryGetRobotFromZone(request, out Robot robot))
+ try
{
- scope = Db.CreateTransaction();
- robot.EnlistTransaction();
- }
- else
- {
- var robotEid = request.Data.GetOrDefault(k.robotEID);
- robot = _robotHelper.LoadRobotForCharacter(robotEid,request.Session.Character);
- }
+ if (TryGetRobotFromZone(request, out Robot robot))
+ {
+ robot.EnlistTransaction();
+ }
+ else
+ {
+ var robotEid = request.Data.GetOrDefault(k.robotEID);
+ robot = _robotHelper.LoadRobotForCharacter(robotEid, request.Session.Character);
+ }
- if (robot == null)
- throw new PerpetuumException(ErrorCodes.RobotNotFound);
+ if (robot == null)
+ throw new PerpetuumException(ErrorCodes.RobotNotFound);
- if ( !robot.IsSingleAndUnpacked)
- throw new PerpetuumException(ErrorCodes.RobotMustbeSingleAndNonRepacked);
+ if (!robot.IsSingleAndUnpacked)
+ throw new PerpetuumException(ErrorCodes.RobotMustbeSingleAndNonRepacked);
- if (ForFitting)
- {
- robot.CheckOwnerOnlyCharacterAndThrowIfFailed(request.Session.Character);
- }
- else
- {
- robot.CheckOwnerCharacterAndCorporationAndThrowIfFailed(request.Session.Character);
- }
+ if (ForFitting)
+ {
+ robot.CheckOwnerOnlyCharacterAndThrowIfFailed(request.Session.Character);
+ }
+ else
+ {
+ robot.CheckOwnerCharacterAndCorporationAndThrowIfFailed(request.Session.Character);
+ }
- switch (robot.GetOrLoadParentEntity())
- {
- case DefaultSystemContainer _:
- case RobotInventory _ when ForFitting:
- case CorporateHangar _ when ForFitting:
+ switch (robot.GetOrLoadParentEntity())
{
- throw new PerpetuumException(ErrorCodes.AccessDenied);
+ case DefaultSystemContainer _:
+ case RobotInventory _ when ForFitting:
+ case CorporateHangar _ when ForFitting:
+ {
+ throw new PerpetuumException(ErrorCodes.AccessDenied);
+ }
}
- }
- var result = new Dictionary
+ var result = new Dictionary
{
{ k.robot,robot.ToDictionary() }
};
- Message.Builder.FromRequest(request).WithData(result).WrapToResult().WithEmpty().Send();
- }
- finally
- {
- scope?.Complete();
+ Message.Builder.FromRequest(request).WithData(result).WrapToResult().WithEmpty().Send();
+ }
+ finally
+ {
+ scope?.Complete();
+ }
}
}
diff --git a/src/Perpetuum/Players/Player.cs b/src/Perpetuum/Players/Player.cs
index 979896ad2..68472e8e5 100644
--- a/src/Perpetuum/Players/Player.cs
+++ b/src/Perpetuum/Players/Player.cs
@@ -315,9 +315,16 @@ public void SendModuleProcessError(Module module, ErrorCodes error)
public void ApplyInvulnerableEffect()
{
var builder = NewEffectBuilder().SetType(EffectType.effect_invulnerable);
+ builder.WithDurationModifier(0.75); //Reduce span of syndicate protection
ApplyEffect(builder);
}
+ public void RemoveInvulnerableEffect()
+ {
+ EffectHandler.RemoveEffectsByType(EffectType.effect_invulnerable);
+ }
+
+
public void ApplyTeleportSicknessEffect()
{
var zone = Zone;
diff --git a/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs b/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs
index 6d78486ca..f70962737 100644
--- a/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs
+++ b/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs
@@ -38,7 +38,7 @@ public static class MarketOrderRepositoryExtensions
public class MarketOrderRepository : IMarketOrderRepository
{
- private const string ORDER_COLUMNS = "marketitemid, marketeid, itemeid, itemdefinition, submittereid, submitted, duration, isSell, price, quantity, usecorporationwallet, isvendoritem, formembersof FROM marketitems ";
+ private const string ORDER_COLUMNS = "marketitems.marketitemid, marketitems.marketeid, marketitems.itemeid, marketitems.itemdefinition, marketitems.submittereid, marketitems.submitted, marketitems.duration, marketitems.isSell, marketitems.price, marketitems.quantity, marketitems.usecorporationwallet, marketitems.isvendoritem, marketitems.formembersof FROM marketitems ";
private const string ORDER_SELECT = "SELECT " + ORDER_COLUMNS;
private const string TOP1_SELECT = "SELECT TOP (1) " + ORDER_COLUMNS;
private readonly MarketOrder.Factory _marketOrderFactory;
@@ -155,7 +155,9 @@ public IEnumerable GetExpiredOrders(TimeSpan duration)
public IEnumerable GetAllByDefinition(int definition)
{
- const string cmd = ORDER_SELECT + @"where itemdefinition = @definition";
+ // this is an example as to why we should not have a table that references itself.
+ // the purpose of this is to not return market items on disabled zones.
+ const string cmd = ORDER_SELECT + @"INNER JOIN entities as childentity on (marketitems.marketeid=childentity.eid) INNER JOIN entities parent on (childentity.eid=parent.eid) INNER JOIN zoneentities on (parent.parent=zoneentities.eid) INNER JOIN zones on (zoneentities.zoneid=zones.id) where itemdefinition = @definition and zones.enabled=1";
return Db.Query().CommandText(cmd)
.SetParameter("@definition", definition)
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs
index 3aa88de06..087c79cff 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs
@@ -53,8 +53,15 @@ public Task DoTeleportAsync(Player player)
player.AddToZone(zone,validPosition,ZoneEnterType.LocalTeleport);
player.SendInitSelf();
- if ( ApplyTeleportSickness )
+ if (ApplyTeleportSickness)
+ {
player.ApplyTeleportSicknessEffect();
+ }
+ if (ApplyInvulnerable)
+ {
+ player.RemoveInvulnerableEffect(); // remove previous effect.
+ player.ApplyInvulnerableEffect(); // re-add effect to restart counter.
+ }
// mozoghat, fade out
player.States.InMoveable = false;
From 75cc3bce20b28399faabb3ac37bd4e83333933e9 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sat, 13 Jan 2018 09:17:13 -0500
Subject: [PATCH 007/457] test feature: alter rift system to give us a random
jump to the stronghold zone.
---
.../Accounting/Characters/Character.cs | 5 +++
src/Perpetuum/Services/RiftSystem/Rift.cs | 33 ++++++++++++++-----
.../Services/RiftSystem/RiftManager.cs | 19 +++++++++--
.../Strategies/TeleportToAnotherZone.cs | 24 ++++++++++++++
4 files changed, 69 insertions(+), 12 deletions(-)
diff --git a/src/Perpetuum/Accounting/Characters/Character.cs b/src/Perpetuum/Accounting/Characters/Character.cs
index cc71d65ee..f9201fd7b 100644
--- a/src/Perpetuum/Accounting/Characters/Character.cs
+++ b/src/Perpetuum/Accounting/Characters/Character.cs
@@ -1055,6 +1055,11 @@ public IZone GetCurrentZone()
return _zoneManager.Value.GetZone(ZoneId ?? -1);
}
+ public IZone GetZone(int zoneiwant)
+ {
+ return _zoneManager.Value.GetZone(zoneiwant);
+ }
+
public ZoneConfiguration GetCurrentZoneConfiguration()
{
return GetCurrentZone()?.Configuration ?? ZoneConfiguration.None;
diff --git a/src/Perpetuum/Services/RiftSystem/Rift.cs b/src/Perpetuum/Services/RiftSystem/Rift.cs
index ff9e047f5..e0c710fae 100644
--- a/src/Perpetuum/Services/RiftSystem/Rift.cs
+++ b/src/Perpetuum/Services/RiftSystem/Rift.cs
@@ -131,6 +131,8 @@ public Rift(ITeleportStrategyFactories teleportStrategyFactories)
_blobEmitter = new BlobEmitter(this);
}
+ public bool IsDestinationStronghold { get; set; } = false;
+
public void SetDespawnTime(TimeSpan despawnTime)
{
_despawnHelper = UnitDespawnHelper.Create(this,despawnTime);
@@ -175,17 +177,30 @@ public void UseItem(Player player)
{
player.HasTeleportSicknessEffect.ThrowIfTrue(ErrorCodes.TeleportTimerStillRunning);
player.HasPvpEffect.ThrowIfTrue(ErrorCodes.CantBeUsedInPvp);
- player.CurrentPosition.IsInRangeOf3D(CurrentPosition, 8).ThrowIfFalse(ErrorCodes.TeleportOutOfRange);
- var nearestRift = Zone.Units.OfType().Where(rift => rift != this).GetNearestUnit(CurrentPosition);
- if (nearestRift == null)
- throw new PerpetuumException(ErrorCodes.WTFErrorMedicalAttentionSuggested);
+ IZone destination = player.Character.GetZone(16);
- var teleport = _teleportStrategyFactories.TeleportWithinZoneFactory();
- teleport.TargetPosition = nearestRift.CurrentPosition;
- teleport.ApplyTeleportSickness = true;
- teleport.ApplyInvulnerable = true;
- teleport.DoTeleportAsync(player);
+ // teleport player to stronghold
+ // stronghold zone must be active.
+ if (this.IsDestinationStronghold && destination != null)
+ {
+ var teleport = _teleportStrategyFactories.TeleportToAnotherZoneFactory(destination);
+ teleport.DoTeleportAsync(player);
+ }
+ else
+ {
+ player.CurrentPosition.IsInRangeOf3D(CurrentPosition, 8).ThrowIfFalse(ErrorCodes.TeleportOutOfRange);
+
+ var nearestRift = Zone.Units.OfType().Where(rift => rift != this).GetNearestUnit(CurrentPosition);
+ if (nearestRift == null)
+ throw new PerpetuumException(ErrorCodes.WTFErrorMedicalAttentionSuggested);
+
+ var teleport = _teleportStrategyFactories.TeleportWithinZoneFactory();
+ teleport.TargetPosition = nearestRift.CurrentPosition;
+ teleport.ApplyTeleportSickness = true;
+ teleport.ApplyInvulnerable = true;
+ teleport.DoTeleportAsync(player);
+ }
}
public double BlobEmission => _blobEmitter.BlobEmission;
diff --git a/src/Perpetuum/Services/RiftSystem/RiftManager.cs b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
index 4662b4aac..40c2c7a87 100644
--- a/src/Perpetuum/Services/RiftSystem/RiftManager.cs
+++ b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
@@ -61,6 +61,8 @@ public class RiftManager
private readonly TimeRange _spawnTime;
private readonly RiftSpawnPositionFinder _spawnPositionFinder;
private readonly IEntityServices _entityServices;
+ private bool StrongHoldRiftGenerated { get; set; } = false;
+ private Random r;
private readonly LinkedList _nextRiftSpawns = new LinkedList();
@@ -70,18 +72,21 @@ public RiftManager(IZone zone,TimeRange spawnTime,RiftSpawnPositionFinder spawnP
_spawnTime = spawnTime;
_spawnPositionFinder = spawnPositionFinder;
_entityServices = entityServices;
+ r = new Random();
}
private int _riftCounts;
public void Update(TimeSpan time)
{
- while (_riftCounts < 20)
+ // FIXME: this needs to be in the database.
+ // do not spawn rifts on zone 16 (the stronghold)
+ while (_riftCounts < 40 && _zone.Id != 16)
{
_nextRiftSpawns.AddLast(new TimeTracker(FastRandom.NextTimeSpan(_spawnTime)));
Interlocked.Increment(ref _riftCounts);
}
-
+
_nextRiftSpawns.RemoveAll(t =>
{
t.Update(time);
@@ -100,9 +105,17 @@ private void SpawnRift()
rift.SetDespawnTime(TimeSpan.FromHours(3));
rift.RemovedFromZone += OnRiftRemovedFromZone;
+ // only generate one stronghold teleport and make it random chance.
+ int rand = r.Next(0, 3);
+ if (rand == 2 && !StrongHoldRiftGenerated)
+ {
+ rift.IsDestinationStronghold = true;
+ this.StrongHoldRiftGenerated = true;
+ }
+
var spawnPosition = _spawnPositionFinder.FindSpawnPosition().ToPosition();
rift.AddToZone(_zone, spawnPosition, ZoneEnterType.NpcSpawn);
- Logger.Info("Rift spawned. " + rift.ED.Name + " (" + rift.CurrentPosition + ")");
+ Logger.Info("Rift spawned. " + rift.ED.Name + " (" + rift.CurrentPosition + ") Stronghold:" + rift.IsDestinationStronghold);
}
private void OnRiftRemovedFromZone(Unit unit)
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
index c65d76376..9df3b255e 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
@@ -3,6 +3,7 @@
using Perpetuum.Data;
using Perpetuum.EntityFramework;
using Perpetuum.Players;
+using Perpetuum.Zones.Finders.PositionFinders;
namespace Perpetuum.Zones.Teleporting.Strategies
{
@@ -37,5 +38,28 @@ public void DoTeleport(Player player)
Task.Delay(1000).ContinueWith(t => _targetZone.Enter(character,Commands.TeleportUse));
});
}
+
+ [CanBeNull]
+ public Task DoTeleportAsync(Player player)
+ {
+ // FIXME: this needs to calculate a proper position but the server does not have the altitude data for this map
+ var validPosition = new Position(1015, 1075);
+ player.States.Teleport = true;
+ Entity.Repository.ForceUpdate(player);
+ var character = player.Character;
+ character.ZoneId = _targetZone.Id;
+ character.ZonePosition = validPosition;
+
+ var task = Task.Delay(10).ContinueWith(t =>
+ {
+ player.RemoveFromZone();
+ player.CurrentSpeed = 0.0;
+ _targetZone.Enter(character, Commands.TeleportUse);
+ player.States.InMoveable = false;
+ player.States.LocalTeleport = false;
+ });
+
+ return task;
+ }
}
}
\ No newline at end of file
From 66042c7f2fefea71673dd3481cac69194d28c931 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sat, 13 Jan 2018 22:05:29 -0500
Subject: [PATCH 008/457] modify rifts slightly.
---
src/Perpetuum/Services/RiftSystem/RiftManager.cs | 5 ++---
.../Zones/Teleporting/Strategies/TeleportToAnotherZone.cs | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/Perpetuum/Services/RiftSystem/RiftManager.cs b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
index 40c2c7a87..489f3ef73 100644
--- a/src/Perpetuum/Services/RiftSystem/RiftManager.cs
+++ b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
@@ -81,7 +81,7 @@ public void Update(TimeSpan time)
{
// FIXME: this needs to be in the database.
// do not spawn rifts on zone 16 (the stronghold)
- while (_riftCounts < 40 && _zone.Id != 16)
+ while (_riftCounts < 10 && _zone.Id != 16)
{
_nextRiftSpawns.AddLast(new TimeTracker(FastRandom.NextTimeSpan(_spawnTime)));
Interlocked.Increment(ref _riftCounts);
@@ -106,11 +106,10 @@ private void SpawnRift()
rift.RemovedFromZone += OnRiftRemovedFromZone;
// only generate one stronghold teleport and make it random chance.
- int rand = r.Next(0, 3);
+ int rand = r.Next(0, 10);
if (rand == 2 && !StrongHoldRiftGenerated)
{
rift.IsDestinationStronghold = true;
- this.StrongHoldRiftGenerated = true;
}
var spawnPosition = _spawnPositionFinder.FindSpawnPosition().ToPosition();
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
index 9df3b255e..70481ad1b 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
@@ -43,7 +43,7 @@ public void DoTeleport(Player player)
public Task DoTeleportAsync(Player player)
{
// FIXME: this needs to calculate a proper position but the server does not have the altitude data for this map
- var validPosition = new Position(1015, 1075);
+ var validPosition = new Position(1120, 1039);
player.States.Teleport = true;
Entity.Repository.ForceUpdate(player);
var character = player.Character;
From 8e852515ef02b9029ffa89ee19d8528e49ba1b4d Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sun, 14 Jan 2018 10:39:26 -0500
Subject: [PATCH 009/457] Fix player trades
---
src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
index e93e9d1a7..137cd9ab7 100644
--- a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
+++ b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
@@ -1575,7 +1575,7 @@ private void InitRelayManager()
_builder.RegisterType().As().SingleInstance();
_builder.RegisterType();
- _builder.RegisterType().As();
+ _builder.RegisterType().SingleInstance().As();
_builder.RegisterType();
From 30ffe56fa8100b1ba09c54f63dc09e864ad1bb28 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sat, 20 Jan 2018 19:17:36 -0500
Subject: [PATCH 010/457] Give new accounts EP when created.
---
.gitattributes | 63 +++++++++++++++++++
.../AdminTools/AccountCreate.cs | 6 ++
.../AdminTools/AccountOpenCreate.cs | 6 ++
3 files changed, 75 insertions(+)
create mode 100644 .gitattributes
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..1ff0c4230
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/src/Perpetuum.RequestHandlers/AdminTools/AccountCreate.cs b/src/Perpetuum.RequestHandlers/AdminTools/AccountCreate.cs
index ff1ab7d2e..1a73f75b6 100644
--- a/src/Perpetuum.RequestHandlers/AdminTools/AccountCreate.cs
+++ b/src/Perpetuum.RequestHandlers/AdminTools/AccountCreate.cs
@@ -1,4 +1,5 @@
using Perpetuum.Accounting;
+using Perpetuum.Data;
using Perpetuum.Host.Requests;
namespace Perpetuum.RequestHandlers.AdminTools
@@ -33,6 +34,11 @@ public void HandleRequest(IRequest request)
_accountRepository.Insert(account);
+ Db.Query().CommandText("extensionPointsInject")
+ .SetParameter("@accountID", account.Id)
+ .SetParameter("@points", 40000)
+ .ExecuteNonQuery();
+
Message.Builder.FromRequest(request).SetData(k.account, account.ToDictionary()).Send();
}
}
diff --git a/src/Perpetuum.RequestHandlers/AdminTools/AccountOpenCreate.cs b/src/Perpetuum.RequestHandlers/AdminTools/AccountOpenCreate.cs
index 1f25bf9e9..3704166ef 100644
--- a/src/Perpetuum.RequestHandlers/AdminTools/AccountOpenCreate.cs
+++ b/src/Perpetuum.RequestHandlers/AdminTools/AccountOpenCreate.cs
@@ -1,4 +1,5 @@
using Perpetuum.Accounting;
+using Perpetuum.Data;
using Perpetuum.Host.Requests;
using Perpetuum.Services.Relay;
@@ -41,6 +42,11 @@ public void HandleRequest(IRequest request)
_accountRepository.Insert(account);
+ Db.Query().CommandText("extensionPointsInject")
+ .SetParameter("@accountID", account.Id)
+ .SetParameter("@points", 40000)
+ .ExecuteNonQuery();
+
Message.Builder.FromRequest(request).SetData(k.account, account.ToDictionary()).Send();
}
}
From d6077acd0e34a4d6a1bd2be4fe3a7418df5aede3 Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Sun, 21 Jan 2018 15:55:50 -0500
Subject: [PATCH 011/457] ep activity falloff, starting, and target level (#6)
---
src/Perpetuum/Accounting/AccountManager.cs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Perpetuum/Accounting/AccountManager.cs b/src/Perpetuum/Accounting/AccountManager.cs
index 77c22aff0..b27817c1f 100644
--- a/src/Perpetuum/Accounting/AccountManager.cs
+++ b/src/Perpetuum/Accounting/AccountManager.cs
@@ -100,9 +100,9 @@ public int GetLockedEpByAccount(Account account)
return lockedEp;
}
- private const double BOOSTMULTIPLIERMAX = 50;
- private const double BOOSTEXPONENT = 2.0;
- private const double SERVER_DESIRED_EP_LEVEL = 3000000;
+ private const double BOOSTMULTIPLIERMAX = 25;
+ private const double BOOSTEXPONENT = 1.5;
+ private const double SERVER_DESIRED_EP_LEVEL = 500000;
public IDictionary GetEPData(Account account,Character character)
{
From 537df8bdda46108a59f276729be836f11e57cb36 Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Sun, 21 Jan 2018 17:05:19 -0500
Subject: [PATCH 012/457] Update LICENSE (#8)
---
LICENSE | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/LICENSE b/LICENSE
index f3cfd2a7c..99ece67c9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,3 +1,7 @@
+----------------------------------------------------------------------------------
+Perpetuum - LICENSE
+----------------------------------------------------------------------------------
+
MIT License
Copyright (c) 2018 Perpetuum
@@ -19,3 +23,30 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+
+----------------------------------------------------------------------------------
+OpenPerpetuum - LICENSE
+----------------------------------------------------------------------------------
+
+MIT License
+
+Copyright (c) 2018 OpenPerpetuum
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software. All copies or substaintial portions
+of the Software will include attributions to the OpenPerpetuum Project.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
From c0ead676ee259a9b40bc254af7b1e502683480a3 Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Sun, 21 Jan 2018 18:33:10 -0500
Subject: [PATCH 013/457] Syndicatification of assignments done; tokens and rep
(#5)
---
.../MissionStructures/MissionLocation.cs | 6 ++++++
.../MissionEngine/Missions/MissionVisitor.cs | 19 +++++++++++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/Perpetuum/Services/MissionEngine/MissionStructures/MissionLocation.cs b/src/Perpetuum/Services/MissionEngine/MissionStructures/MissionLocation.cs
index 7d64f00a9..4b32cd347 100644
--- a/src/Perpetuum/Services/MissionEngine/MissionStructures/MissionLocation.cs
+++ b/src/Perpetuum/Services/MissionEngine/MissionStructures/MissionLocation.cs
@@ -225,6 +225,12 @@ 3 asia_great_corp
*/
public int GetRaceSpecificCoinDefinition()
{
+ //TODO: Fixme: I am a hack for Syndicatification
+ if(this.zoneId==0 || this.zoneId == 8) //For New Virginia and Hershfield
+ {
+ return EntityDefault.GetByName(DefinitionNames.UNIVERSAL_MISSION_COIN).Definition;
+ }
+ //--end hack--
switch (RaceId)
{
case 1:
diff --git a/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs b/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs
index f55ebe287..32a518cfe 100644
--- a/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs
+++ b/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs
@@ -162,8 +162,23 @@ public override void VisitRandomMission(RandomMission randomMission)
var positiveAllianceEid = _missionLocation.Agent.OwnerAlliance.Eid;
var opposingAllianceEid = DefaultCorporationDataCache.SelectOpposingAlliance(positiveAllianceEid);
- _standingChanges = new[] {new MissionStandingChange(positiveAllianceEid, standingValue), new MissionStandingChange(opposingAllianceEid, negativeValue) };
-
+
+ //TODO: Fixme: I am a hack for Syndicatification
+ if (this._missionLocation.zoneId == 0 || this._missionLocation.zoneId == 8) //For New Virginia and Hershfield
+ {
+ //Implementation: Add reputation for all factions equally -- No factional bias!
+ IEnumerable allianceEids = DefaultCorporationDataCache.GetMegaCorporationEids();
+ List standingChangeForSyndicatification = new List();
+ foreach(long id in allianceEids)
+ {
+ standingChangeForSyndicatification.Add(new MissionStandingChange(id, standingValue));
+ }
+ _standingChanges = standingChangeForSyndicatification.ToArray();
+ }//--end hack--
+ else
+ {
+ _standingChanges = new[] { new MissionStandingChange(positiveAllianceEid, standingValue), new MissionStandingChange(opposingAllianceEid, negativeValue) };
+ }
}
}
From d481551ee7bb235d3d7fc9b14954e0431d59a8dd Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Sun, 21 Jan 2018 18:33:27 -0500
Subject: [PATCH 014/457] Starting nic to 500k; TODO still should move to DB
(#4)
---
.../Zones/Teleporting/Strategies/TrainingExitStrategy.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs
index e82e5d0c2..66fad4851 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs
@@ -14,7 +14,7 @@ namespace Perpetuum.Zones.Teleporting.Strategies
{
public class TrainingExitStrategy : ITeleportStrategy
{
- private const double CHARACTER_START_CREDIT = 20000;
+ private const double CHARACTER_START_CREDIT = 500000; //TODO: move to DB
private const int MAX_REWARD_LEVEL = 4;
private readonly TeleportDescription _description;
From 505ef9d2d9f84cd35544906e10f581e9001bd566 Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Sat, 27 Jan 2018 12:49:04 -0500
Subject: [PATCH 015/457] use unicoin on itemshop (#10)
---
src/Perpetuum/Services/ItemShop/ItemShop.cs | 35 +++++++++++--------
.../Services/ItemShop/ItemShopEntry.cs | 23 ++++++++----
2 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/src/Perpetuum/Services/ItemShop/ItemShop.cs b/src/Perpetuum/Services/ItemShop/ItemShop.cs
index 04a4825c1..a8d0197ab 100644
--- a/src/Perpetuum/Services/ItemShop/ItemShop.cs
+++ b/src/Perpetuum/Services/ItemShop/ItemShop.cs
@@ -19,7 +19,7 @@ public class ItemShop : Unit
private readonly IStandingHandler _standingHandler;
private readonly CharacterWalletFactory _characterWalletFactory;
- public ItemShop(IStandingHandler standingHandler,CharacterWalletFactory characterWalletFactory)
+ public ItemShop(IStandingHandler standingHandler, CharacterWalletFactory characterWalletFactory)
{
_standingHandler = standingHandler;
_characterWalletFactory = characterWalletFactory;
@@ -42,7 +42,7 @@ private ItemShopEntry GetEntry(int entryID)
JOIN itemshoplocations sl ON its.presetid = sl.presetid
WHERE sl.locationeid = @eid AND its.id = @id";
- var record = Db.Query().CommandText(qryStr).SetParameter("@eid",Eid).SetParameter("@id", entryID).ExecuteSingleRow();
+ var record = Db.Query().CommandText(qryStr).SetParameter("@eid", Eid).SetParameter("@id", entryID).ExecuteSingleRow();
if (record == null)
return null;
@@ -56,7 +56,7 @@ private List GetAll()
JOIN itemshoplocations sl ON its.presetid = sl.presetid
WHERE sl.locationeid = @eid";
- var records = Db.Query().CommandText(qryStr).SetParameter("@eid",Eid).Execute();
+ var records = Db.Query().CommandText(qryStr).SetParameter("@eid", Eid).Execute();
var entries = new List();
@@ -82,11 +82,9 @@ private static ItemShopEntry CreateItemShopEntryFromRecord(IDataRecord record)
var tmCoin = record.GetValue("tmCoin") ?? 0;
var icsCoin = record.GetValue("icscoin") ?? 0;
var asiCoin = record.GetValue("asicoin") ?? 0;
+ var uniCoin = record.GetValue("unicoin") ?? 0;
-
-
-
- return new ItemShopEntry(id, EntityDefault.Get(targetDefinition), targetAmount, tmCoin,icsCoin,asiCoin , price, globalLimit, purchaseCount,standing);
+ return new ItemShopEntry(id, EntityDefault.Get(targetDefinition), targetAmount, tmCoin, icsCoin, asiCoin, uniCoin, price, globalLimit, purchaseCount, standing);
}
public Dictionary EntriesToDictionary()
@@ -96,7 +94,7 @@ public Dictionary EntriesToDictionary()
private void CheckStanding(Character character, ItemShopEntry shopEntry)
{
- if ( shopEntry.Standing == null)
+ if (shopEntry.Standing == null)
return;
var standing = _standingHandler.GetStanding(Owner, character.Eid);
@@ -114,7 +112,7 @@ public void Buy(Container container, Character character, int entryID, int quant
throw new PerpetuumException(ErrorCodes.ItemNotFound);
entry.CheckGlobalLimit(quantity);
- CheckStanding(character,entry);
+ CheckStanding(character, entry);
entry.RemoveFromContainer(container, quantity);
@@ -135,14 +133,14 @@ public void Buy(Container container, Character character, int entryID, int quant
var targetItem = entry.CreateTargetItem(character, quantity);
container.AddItem(targetItem, true);
- UpdateGlobalPurchaseCount(targetItem.Definition,targetItem.Quantity);
+ UpdateGlobalPurchaseCount(targetItem.Definition, targetItem.Quantity);
if (entry.TmCoin > 0)
- character.LogTransaction(TransactionLogEvent.Builder()
- .SetTransactionType(TransactionType.ItemShopTake)
- .SetCharacter(character)
- .SetContainer(container)
- .SetItem(EntityDefault.GetByName(DefinitionNames.TM_MISSION_COIN).Definition, entry.TmCoin * quantity));
+ character.LogTransaction(TransactionLogEvent.Builder()
+ .SetTransactionType(TransactionType.ItemShopTake)
+ .SetCharacter(character)
+ .SetContainer(container)
+ .SetItem(EntityDefault.GetByName(DefinitionNames.TM_MISSION_COIN).Definition, entry.TmCoin * quantity));
if (entry.IcsCoin > 0)
character.LogTransaction(TransactionLogEvent.Builder()
@@ -158,6 +156,13 @@ public void Buy(Container container, Character character, int entryID, int quant
.SetContainer(container)
.SetItem(EntityDefault.GetByName(DefinitionNames.ASI_MISSION_COIN).Definition, entry.AsiCoin * quantity));
+ if (entry.UniCoin > 0)
+ character.LogTransaction(TransactionLogEvent.Builder()
+ .SetTransactionType(TransactionType.ItemShopTake)
+ .SetCharacter(character)
+ .SetContainer(container)
+ .SetItem(EntityDefault.GetByName(DefinitionNames.UNIVERSAL_MISSION_COIN).Definition, entry.UniCoin * quantity));
+
character.LogTransaction(TransactionLogEvent.Builder()
.SetTransactionType(TransactionType.ItemShopBuy)
diff --git a/src/Perpetuum/Services/ItemShop/ItemShopEntry.cs b/src/Perpetuum/Services/ItemShop/ItemShopEntry.cs
index 86d478bd1..a4c5f205c 100644
--- a/src/Perpetuum/Services/ItemShop/ItemShopEntry.cs
+++ b/src/Perpetuum/Services/ItemShop/ItemShopEntry.cs
@@ -14,12 +14,13 @@ public class ItemShopEntry
private readonly int _tmcoin;
private readonly int _icscoin;
private readonly int _asicoin;
+ private readonly int _unicoin;
private readonly double _credit;
private readonly int? _globalLimit;
private readonly int _purchaseCount;
private readonly double? _standing;
- public ItemShopEntry(int id,EntityDefault targetItemED,int targetItemAmount,int tmcoin, int icscoin, int asicoin, double credit, int? globalLimit, int purchaseCount,double? standing)
+ public ItemShopEntry(int id, EntityDefault targetItemED, int targetItemAmount, int tmcoin, int icscoin, int asicoin, int unicoin, double credit, int? globalLimit, int purchaseCount, double? standing)
{
_id = id;
_targetItemED = targetItemED;
@@ -27,6 +28,7 @@ public ItemShopEntry(int id,EntityDefault targetItemED,int targetItemAmount,int
_tmcoin = tmcoin;
_icscoin = icscoin;
_asicoin = asicoin;
+ _unicoin = unicoin;
_credit = credit;
_purchaseCount = purchaseCount;
_globalLimit = globalLimit;
@@ -53,18 +55,20 @@ public int TmCoin
get { return _tmcoin; }
}
-
public int AsiCoin
{
get { return _asicoin; }
}
-
public int IcsCoin
{
get { return _icscoin; }
}
+ public int UniCoin
+ {
+ get { return _unicoin; }
+ }
public double Credit
{
@@ -78,7 +82,7 @@ public double? Standing
public Dictionary ToDictionary()
{
- var d = new Dictionary();
+ var d = new Dictionary();
d[k.ID] = _id;
d[k.targetDefinition] = _targetItemED.Definition;
@@ -90,10 +94,11 @@ public Dictionary ToDictionary()
d[k.tmcoin] = _tmcoin;
d[k.icscoin] = _icscoin;
d[k.asicoin] = _asicoin;
+ d[k.unicoin] = _unicoin;
return d;
}
- public Item CreateTargetItem(Character owner,int quantity)
+ public Item CreateTargetItem(Character owner, int quantity)
{
var targetItem = (Item)Entity.Factory.CreateWithRandomEID(TargetItemED);
targetItem.Owner = owner.Eid;
@@ -110,7 +115,7 @@ public void CheckGlobalLimit(int quantity)
if (GlobalLimit <= PurchaseCount)
throw new PerpetuumException(ErrorCodes.OutOfItemGlobally);
- var availableAmount = (int) GlobalLimit - PurchaseCount;
+ var availableAmount = (int)GlobalLimit - PurchaseCount;
//clamp to the available maximum
if (availableAmount < quantity)
@@ -137,6 +142,12 @@ public void RemoveFromContainer(Container container, int quantity)
var ac = Coin.CreateASICoin(_asicoin);
ac.RemoveFromContainer(container, quantity);
}
+
+ if (_unicoin > 0)
+ {
+ var ac = Coin.CreateUniversalCoin(_unicoin);
+ ac.RemoveFromContainer(container, quantity);
+ }
}
}
}
\ No newline at end of file
From 54100d2a443d592e9d27d7928d86aa21bc52c5e3 Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Sun, 28 Jan 2018 17:29:00 -0500
Subject: [PATCH 016/457] Pre-Alpha Server v1 (#12)
* Gitignore and startup args (#1)
Gitignore and args
* Fix for field terminals.
* fix remote market server error
* gives player equal syndicate protection and molecular instability when teleporting.
* Tweak syndicate protection to be 25% less than instability
* Fix for field terminals. (#2)
* Fix for field terminals.
* fix remote market server error
* gives player equal syndicate protection and molecular instability when teleporting.
* Tweak syndicate protection to be 25% less than instability
* test feature: alter rift system to give us a random jump to the stronghold zone.
* modify rifts slightly.
* Fix player trades
* Give new accounts EP when created.
* ep activity falloff, starting, and target level (#6)
* Update LICENSE (#8)
* Syndicatification of assignments done; tokens and rep (#5)
* Starting nic to 500k; TODO still should move to DB (#4)
* use unicoin on itemshop (#10)
---
.gitattributes | 63 +++++
.gitignore | 261 ++++++++++++++++++
LICENSE | 31 +++
.../PerpetuumBootstrapper.cs | 2 +-
.../AdminTools/AccountCreate.cs | 6 +
.../AdminTools/AccountOpenCreate.cs | 6 +
src/Perpetuum.RequestHandlers/GetRobotInfo.cs | 74 ++---
.../Perpetuum.Server.csproj.user | 12 +-
src/Perpetuum/Accounting/AccountManager.cs | 6 +-
.../Accounting/Characters/Character.cs | 5 +
src/Perpetuum/Players/Player.cs | 7 +
src/Perpetuum/Services/ItemShop/ItemShop.cs | 35 ++-
.../Services/ItemShop/ItemShopEntry.cs | 23 +-
.../MarketEngine/MarketOrderRepository.cs | 6 +-
.../MissionStructures/MissionLocation.cs | 6 +
.../MissionEngine/Missions/MissionVisitor.cs | 19 +-
src/Perpetuum/Services/RiftSystem/Rift.cs | 33 ++-
.../Services/RiftSystem/RiftManager.cs | 18 +-
.../Strategies/TeleportToAnotherZone.cs | 24 ++
.../Strategies/TeleportWithinZone.cs | 9 +-
.../Strategies/TrainingExitStrategy.cs | 2 +-
21 files changed, 568 insertions(+), 80 deletions(-)
create mode 100644 .gitattributes
create mode 100644 .gitignore
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..1ff0c4230
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..3c4efe206
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,261 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
index f3cfd2a7c..99ece67c9 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,3 +1,7 @@
+----------------------------------------------------------------------------------
+Perpetuum - LICENSE
+----------------------------------------------------------------------------------
+
MIT License
Copyright (c) 2018 Perpetuum
@@ -19,3 +23,30 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+
+----------------------------------------------------------------------------------
+OpenPerpetuum - LICENSE
+----------------------------------------------------------------------------------
+
+MIT License
+
+Copyright (c) 2018 OpenPerpetuum
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software. All copies or substaintial portions
+of the Software will include attributions to the OpenPerpetuum Project.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
index e93e9d1a7..137cd9ab7 100644
--- a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
+++ b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
@@ -1575,7 +1575,7 @@ private void InitRelayManager()
_builder.RegisterType().As().SingleInstance();
_builder.RegisterType();
- _builder.RegisterType().As();
+ _builder.RegisterType().SingleInstance().As();
_builder.RegisterType();
diff --git a/src/Perpetuum.RequestHandlers/AdminTools/AccountCreate.cs b/src/Perpetuum.RequestHandlers/AdminTools/AccountCreate.cs
index ff1ab7d2e..1a73f75b6 100644
--- a/src/Perpetuum.RequestHandlers/AdminTools/AccountCreate.cs
+++ b/src/Perpetuum.RequestHandlers/AdminTools/AccountCreate.cs
@@ -1,4 +1,5 @@
using Perpetuum.Accounting;
+using Perpetuum.Data;
using Perpetuum.Host.Requests;
namespace Perpetuum.RequestHandlers.AdminTools
@@ -33,6 +34,11 @@ public void HandleRequest(IRequest request)
_accountRepository.Insert(account);
+ Db.Query().CommandText("extensionPointsInject")
+ .SetParameter("@accountID", account.Id)
+ .SetParameter("@points", 40000)
+ .ExecuteNonQuery();
+
Message.Builder.FromRequest(request).SetData(k.account, account.ToDictionary()).Send();
}
}
diff --git a/src/Perpetuum.RequestHandlers/AdminTools/AccountOpenCreate.cs b/src/Perpetuum.RequestHandlers/AdminTools/AccountOpenCreate.cs
index 1f25bf9e9..3704166ef 100644
--- a/src/Perpetuum.RequestHandlers/AdminTools/AccountOpenCreate.cs
+++ b/src/Perpetuum.RequestHandlers/AdminTools/AccountOpenCreate.cs
@@ -1,4 +1,5 @@
using Perpetuum.Accounting;
+using Perpetuum.Data;
using Perpetuum.Host.Requests;
using Perpetuum.Services.Relay;
@@ -41,6 +42,11 @@ public void HandleRequest(IRequest request)
_accountRepository.Insert(account);
+ Db.Query().CommandText("extensionPointsInject")
+ .SetParameter("@accountID", account.Id)
+ .SetParameter("@points", 40000)
+ .ExecuteNonQuery();
+
Message.Builder.FromRequest(request).SetData(k.account, account.ToDictionary()).Send();
}
}
diff --git a/src/Perpetuum.RequestHandlers/GetRobotInfo.cs b/src/Perpetuum.RequestHandlers/GetRobotInfo.cs
index 9fca34eb9..77dfc3360 100644
--- a/src/Perpetuum.RequestHandlers/GetRobotInfo.cs
+++ b/src/Perpetuum.RequestHandlers/GetRobotInfo.cs
@@ -24,55 +24,57 @@ public GetRobotInfo(IZoneManager zoneManager,RobotHelper robotHelper)
public void HandleRequest(IRequest request)
{
- TransactionScope scope = null;
- try
+ // make sure the transaction scope is disposed of properly.
+ using (TransactionScope scope = Db.CreateTransaction())
{
- if (TryGetRobotFromZone(request, out Robot robot))
+ try
{
- scope = Db.CreateTransaction();
- robot.EnlistTransaction();
- }
- else
- {
- var robotEid = request.Data.GetOrDefault(k.robotEID);
- robot = _robotHelper.LoadRobotForCharacter(robotEid,request.Session.Character);
- }
+ if (TryGetRobotFromZone(request, out Robot robot))
+ {
+ robot.EnlistTransaction();
+ }
+ else
+ {
+ var robotEid = request.Data.GetOrDefault(k.robotEID);
+ robot = _robotHelper.LoadRobotForCharacter(robotEid, request.Session.Character);
+ }
- if (robot == null)
- throw new PerpetuumException(ErrorCodes.RobotNotFound);
+ if (robot == null)
+ throw new PerpetuumException(ErrorCodes.RobotNotFound);
- if ( !robot.IsSingleAndUnpacked)
- throw new PerpetuumException(ErrorCodes.RobotMustbeSingleAndNonRepacked);
+ if (!robot.IsSingleAndUnpacked)
+ throw new PerpetuumException(ErrorCodes.RobotMustbeSingleAndNonRepacked);
- if (ForFitting)
- {
- robot.CheckOwnerOnlyCharacterAndThrowIfFailed(request.Session.Character);
- }
- else
- {
- robot.CheckOwnerCharacterAndCorporationAndThrowIfFailed(request.Session.Character);
- }
+ if (ForFitting)
+ {
+ robot.CheckOwnerOnlyCharacterAndThrowIfFailed(request.Session.Character);
+ }
+ else
+ {
+ robot.CheckOwnerCharacterAndCorporationAndThrowIfFailed(request.Session.Character);
+ }
- switch (robot.GetOrLoadParentEntity())
- {
- case DefaultSystemContainer _:
- case RobotInventory _ when ForFitting:
- case CorporateHangar _ when ForFitting:
+ switch (robot.GetOrLoadParentEntity())
{
- throw new PerpetuumException(ErrorCodes.AccessDenied);
+ case DefaultSystemContainer _:
+ case RobotInventory _ when ForFitting:
+ case CorporateHangar _ when ForFitting:
+ {
+ throw new PerpetuumException(ErrorCodes.AccessDenied);
+ }
}
- }
- var result = new Dictionary
+ var result = new Dictionary
{
{ k.robot,robot.ToDictionary() }
};
- Message.Builder.FromRequest(request).WithData(result).WrapToResult().WithEmpty().Send();
- }
- finally
- {
- scope?.Complete();
+ Message.Builder.FromRequest(request).WithData(result).WrapToResult().WithEmpty().Send();
+ }
+ finally
+ {
+ scope?.Complete();
+ }
}
}
diff --git a/src/Perpetuum.Server/Perpetuum.Server.csproj.user b/src/Perpetuum.Server/Perpetuum.Server.csproj.user
index a15ccb472..6f4cef0a6 100644
--- a/src/Perpetuum.Server/Perpetuum.Server.csproj.user
+++ b/src/Perpetuum.Server/Perpetuum.Server.csproj.user
@@ -1,9 +1,19 @@
- d:\work\server\genxy
+ C:\PerpetuumServer\data
a:\work\server\genxy
+
+ publish\
+
+
+
+
+
+ en-US
+ false
+
\ No newline at end of file
diff --git a/src/Perpetuum/Accounting/AccountManager.cs b/src/Perpetuum/Accounting/AccountManager.cs
index 77c22aff0..b27817c1f 100644
--- a/src/Perpetuum/Accounting/AccountManager.cs
+++ b/src/Perpetuum/Accounting/AccountManager.cs
@@ -100,9 +100,9 @@ public int GetLockedEpByAccount(Account account)
return lockedEp;
}
- private const double BOOSTMULTIPLIERMAX = 50;
- private const double BOOSTEXPONENT = 2.0;
- private const double SERVER_DESIRED_EP_LEVEL = 3000000;
+ private const double BOOSTMULTIPLIERMAX = 25;
+ private const double BOOSTEXPONENT = 1.5;
+ private const double SERVER_DESIRED_EP_LEVEL = 500000;
public IDictionary GetEPData(Account account,Character character)
{
diff --git a/src/Perpetuum/Accounting/Characters/Character.cs b/src/Perpetuum/Accounting/Characters/Character.cs
index cc71d65ee..f9201fd7b 100644
--- a/src/Perpetuum/Accounting/Characters/Character.cs
+++ b/src/Perpetuum/Accounting/Characters/Character.cs
@@ -1055,6 +1055,11 @@ public IZone GetCurrentZone()
return _zoneManager.Value.GetZone(ZoneId ?? -1);
}
+ public IZone GetZone(int zoneiwant)
+ {
+ return _zoneManager.Value.GetZone(zoneiwant);
+ }
+
public ZoneConfiguration GetCurrentZoneConfiguration()
{
return GetCurrentZone()?.Configuration ?? ZoneConfiguration.None;
diff --git a/src/Perpetuum/Players/Player.cs b/src/Perpetuum/Players/Player.cs
index 979896ad2..68472e8e5 100644
--- a/src/Perpetuum/Players/Player.cs
+++ b/src/Perpetuum/Players/Player.cs
@@ -315,9 +315,16 @@ public void SendModuleProcessError(Module module, ErrorCodes error)
public void ApplyInvulnerableEffect()
{
var builder = NewEffectBuilder().SetType(EffectType.effect_invulnerable);
+ builder.WithDurationModifier(0.75); //Reduce span of syndicate protection
ApplyEffect(builder);
}
+ public void RemoveInvulnerableEffect()
+ {
+ EffectHandler.RemoveEffectsByType(EffectType.effect_invulnerable);
+ }
+
+
public void ApplyTeleportSicknessEffect()
{
var zone = Zone;
diff --git a/src/Perpetuum/Services/ItemShop/ItemShop.cs b/src/Perpetuum/Services/ItemShop/ItemShop.cs
index 04a4825c1..a8d0197ab 100644
--- a/src/Perpetuum/Services/ItemShop/ItemShop.cs
+++ b/src/Perpetuum/Services/ItemShop/ItemShop.cs
@@ -19,7 +19,7 @@ public class ItemShop : Unit
private readonly IStandingHandler _standingHandler;
private readonly CharacterWalletFactory _characterWalletFactory;
- public ItemShop(IStandingHandler standingHandler,CharacterWalletFactory characterWalletFactory)
+ public ItemShop(IStandingHandler standingHandler, CharacterWalletFactory characterWalletFactory)
{
_standingHandler = standingHandler;
_characterWalletFactory = characterWalletFactory;
@@ -42,7 +42,7 @@ private ItemShopEntry GetEntry(int entryID)
JOIN itemshoplocations sl ON its.presetid = sl.presetid
WHERE sl.locationeid = @eid AND its.id = @id";
- var record = Db.Query().CommandText(qryStr).SetParameter("@eid",Eid).SetParameter("@id", entryID).ExecuteSingleRow();
+ var record = Db.Query().CommandText(qryStr).SetParameter("@eid", Eid).SetParameter("@id", entryID).ExecuteSingleRow();
if (record == null)
return null;
@@ -56,7 +56,7 @@ private List GetAll()
JOIN itemshoplocations sl ON its.presetid = sl.presetid
WHERE sl.locationeid = @eid";
- var records = Db.Query().CommandText(qryStr).SetParameter("@eid",Eid).Execute();
+ var records = Db.Query().CommandText(qryStr).SetParameter("@eid", Eid).Execute();
var entries = new List();
@@ -82,11 +82,9 @@ private static ItemShopEntry CreateItemShopEntryFromRecord(IDataRecord record)
var tmCoin = record.GetValue("tmCoin") ?? 0;
var icsCoin = record.GetValue("icscoin") ?? 0;
var asiCoin = record.GetValue("asicoin") ?? 0;
+ var uniCoin = record.GetValue("unicoin") ?? 0;
-
-
-
- return new ItemShopEntry(id, EntityDefault.Get(targetDefinition), targetAmount, tmCoin,icsCoin,asiCoin , price, globalLimit, purchaseCount,standing);
+ return new ItemShopEntry(id, EntityDefault.Get(targetDefinition), targetAmount, tmCoin, icsCoin, asiCoin, uniCoin, price, globalLimit, purchaseCount, standing);
}
public Dictionary EntriesToDictionary()
@@ -96,7 +94,7 @@ public Dictionary EntriesToDictionary()
private void CheckStanding(Character character, ItemShopEntry shopEntry)
{
- if ( shopEntry.Standing == null)
+ if (shopEntry.Standing == null)
return;
var standing = _standingHandler.GetStanding(Owner, character.Eid);
@@ -114,7 +112,7 @@ public void Buy(Container container, Character character, int entryID, int quant
throw new PerpetuumException(ErrorCodes.ItemNotFound);
entry.CheckGlobalLimit(quantity);
- CheckStanding(character,entry);
+ CheckStanding(character, entry);
entry.RemoveFromContainer(container, quantity);
@@ -135,14 +133,14 @@ public void Buy(Container container, Character character, int entryID, int quant
var targetItem = entry.CreateTargetItem(character, quantity);
container.AddItem(targetItem, true);
- UpdateGlobalPurchaseCount(targetItem.Definition,targetItem.Quantity);
+ UpdateGlobalPurchaseCount(targetItem.Definition, targetItem.Quantity);
if (entry.TmCoin > 0)
- character.LogTransaction(TransactionLogEvent.Builder()
- .SetTransactionType(TransactionType.ItemShopTake)
- .SetCharacter(character)
- .SetContainer(container)
- .SetItem(EntityDefault.GetByName(DefinitionNames.TM_MISSION_COIN).Definition, entry.TmCoin * quantity));
+ character.LogTransaction(TransactionLogEvent.Builder()
+ .SetTransactionType(TransactionType.ItemShopTake)
+ .SetCharacter(character)
+ .SetContainer(container)
+ .SetItem(EntityDefault.GetByName(DefinitionNames.TM_MISSION_COIN).Definition, entry.TmCoin * quantity));
if (entry.IcsCoin > 0)
character.LogTransaction(TransactionLogEvent.Builder()
@@ -158,6 +156,13 @@ public void Buy(Container container, Character character, int entryID, int quant
.SetContainer(container)
.SetItem(EntityDefault.GetByName(DefinitionNames.ASI_MISSION_COIN).Definition, entry.AsiCoin * quantity));
+ if (entry.UniCoin > 0)
+ character.LogTransaction(TransactionLogEvent.Builder()
+ .SetTransactionType(TransactionType.ItemShopTake)
+ .SetCharacter(character)
+ .SetContainer(container)
+ .SetItem(EntityDefault.GetByName(DefinitionNames.UNIVERSAL_MISSION_COIN).Definition, entry.UniCoin * quantity));
+
character.LogTransaction(TransactionLogEvent.Builder()
.SetTransactionType(TransactionType.ItemShopBuy)
diff --git a/src/Perpetuum/Services/ItemShop/ItemShopEntry.cs b/src/Perpetuum/Services/ItemShop/ItemShopEntry.cs
index 86d478bd1..a4c5f205c 100644
--- a/src/Perpetuum/Services/ItemShop/ItemShopEntry.cs
+++ b/src/Perpetuum/Services/ItemShop/ItemShopEntry.cs
@@ -14,12 +14,13 @@ public class ItemShopEntry
private readonly int _tmcoin;
private readonly int _icscoin;
private readonly int _asicoin;
+ private readonly int _unicoin;
private readonly double _credit;
private readonly int? _globalLimit;
private readonly int _purchaseCount;
private readonly double? _standing;
- public ItemShopEntry(int id,EntityDefault targetItemED,int targetItemAmount,int tmcoin, int icscoin, int asicoin, double credit, int? globalLimit, int purchaseCount,double? standing)
+ public ItemShopEntry(int id, EntityDefault targetItemED, int targetItemAmount, int tmcoin, int icscoin, int asicoin, int unicoin, double credit, int? globalLimit, int purchaseCount, double? standing)
{
_id = id;
_targetItemED = targetItemED;
@@ -27,6 +28,7 @@ public ItemShopEntry(int id,EntityDefault targetItemED,int targetItemAmount,int
_tmcoin = tmcoin;
_icscoin = icscoin;
_asicoin = asicoin;
+ _unicoin = unicoin;
_credit = credit;
_purchaseCount = purchaseCount;
_globalLimit = globalLimit;
@@ -53,18 +55,20 @@ public int TmCoin
get { return _tmcoin; }
}
-
public int AsiCoin
{
get { return _asicoin; }
}
-
public int IcsCoin
{
get { return _icscoin; }
}
+ public int UniCoin
+ {
+ get { return _unicoin; }
+ }
public double Credit
{
@@ -78,7 +82,7 @@ public double? Standing
public Dictionary ToDictionary()
{
- var d = new Dictionary();
+ var d = new Dictionary();
d[k.ID] = _id;
d[k.targetDefinition] = _targetItemED.Definition;
@@ -90,10 +94,11 @@ public Dictionary ToDictionary()
d[k.tmcoin] = _tmcoin;
d[k.icscoin] = _icscoin;
d[k.asicoin] = _asicoin;
+ d[k.unicoin] = _unicoin;
return d;
}
- public Item CreateTargetItem(Character owner,int quantity)
+ public Item CreateTargetItem(Character owner, int quantity)
{
var targetItem = (Item)Entity.Factory.CreateWithRandomEID(TargetItemED);
targetItem.Owner = owner.Eid;
@@ -110,7 +115,7 @@ public void CheckGlobalLimit(int quantity)
if (GlobalLimit <= PurchaseCount)
throw new PerpetuumException(ErrorCodes.OutOfItemGlobally);
- var availableAmount = (int) GlobalLimit - PurchaseCount;
+ var availableAmount = (int)GlobalLimit - PurchaseCount;
//clamp to the available maximum
if (availableAmount < quantity)
@@ -137,6 +142,12 @@ public void RemoveFromContainer(Container container, int quantity)
var ac = Coin.CreateASICoin(_asicoin);
ac.RemoveFromContainer(container, quantity);
}
+
+ if (_unicoin > 0)
+ {
+ var ac = Coin.CreateUniversalCoin(_unicoin);
+ ac.RemoveFromContainer(container, quantity);
+ }
}
}
}
\ No newline at end of file
diff --git a/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs b/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs
index 6d78486ca..f70962737 100644
--- a/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs
+++ b/src/Perpetuum/Services/MarketEngine/MarketOrderRepository.cs
@@ -38,7 +38,7 @@ public static class MarketOrderRepositoryExtensions
public class MarketOrderRepository : IMarketOrderRepository
{
- private const string ORDER_COLUMNS = "marketitemid, marketeid, itemeid, itemdefinition, submittereid, submitted, duration, isSell, price, quantity, usecorporationwallet, isvendoritem, formembersof FROM marketitems ";
+ private const string ORDER_COLUMNS = "marketitems.marketitemid, marketitems.marketeid, marketitems.itemeid, marketitems.itemdefinition, marketitems.submittereid, marketitems.submitted, marketitems.duration, marketitems.isSell, marketitems.price, marketitems.quantity, marketitems.usecorporationwallet, marketitems.isvendoritem, marketitems.formembersof FROM marketitems ";
private const string ORDER_SELECT = "SELECT " + ORDER_COLUMNS;
private const string TOP1_SELECT = "SELECT TOP (1) " + ORDER_COLUMNS;
private readonly MarketOrder.Factory _marketOrderFactory;
@@ -155,7 +155,9 @@ public IEnumerable GetExpiredOrders(TimeSpan duration)
public IEnumerable GetAllByDefinition(int definition)
{
- const string cmd = ORDER_SELECT + @"where itemdefinition = @definition";
+ // this is an example as to why we should not have a table that references itself.
+ // the purpose of this is to not return market items on disabled zones.
+ const string cmd = ORDER_SELECT + @"INNER JOIN entities as childentity on (marketitems.marketeid=childentity.eid) INNER JOIN entities parent on (childentity.eid=parent.eid) INNER JOIN zoneentities on (parent.parent=zoneentities.eid) INNER JOIN zones on (zoneentities.zoneid=zones.id) where itemdefinition = @definition and zones.enabled=1";
return Db.Query().CommandText(cmd)
.SetParameter("@definition", definition)
diff --git a/src/Perpetuum/Services/MissionEngine/MissionStructures/MissionLocation.cs b/src/Perpetuum/Services/MissionEngine/MissionStructures/MissionLocation.cs
index 7d64f00a9..4b32cd347 100644
--- a/src/Perpetuum/Services/MissionEngine/MissionStructures/MissionLocation.cs
+++ b/src/Perpetuum/Services/MissionEngine/MissionStructures/MissionLocation.cs
@@ -225,6 +225,12 @@ 3 asia_great_corp
*/
public int GetRaceSpecificCoinDefinition()
{
+ //TODO: Fixme: I am a hack for Syndicatification
+ if(this.zoneId==0 || this.zoneId == 8) //For New Virginia and Hershfield
+ {
+ return EntityDefault.GetByName(DefinitionNames.UNIVERSAL_MISSION_COIN).Definition;
+ }
+ //--end hack--
switch (RaceId)
{
case 1:
diff --git a/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs b/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs
index f55ebe287..32a518cfe 100644
--- a/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs
+++ b/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs
@@ -162,8 +162,23 @@ public override void VisitRandomMission(RandomMission randomMission)
var positiveAllianceEid = _missionLocation.Agent.OwnerAlliance.Eid;
var opposingAllianceEid = DefaultCorporationDataCache.SelectOpposingAlliance(positiveAllianceEid);
- _standingChanges = new[] {new MissionStandingChange(positiveAllianceEid, standingValue), new MissionStandingChange(opposingAllianceEid, negativeValue) };
-
+
+ //TODO: Fixme: I am a hack for Syndicatification
+ if (this._missionLocation.zoneId == 0 || this._missionLocation.zoneId == 8) //For New Virginia and Hershfield
+ {
+ //Implementation: Add reputation for all factions equally -- No factional bias!
+ IEnumerable allianceEids = DefaultCorporationDataCache.GetMegaCorporationEids();
+ List standingChangeForSyndicatification = new List();
+ foreach(long id in allianceEids)
+ {
+ standingChangeForSyndicatification.Add(new MissionStandingChange(id, standingValue));
+ }
+ _standingChanges = standingChangeForSyndicatification.ToArray();
+ }//--end hack--
+ else
+ {
+ _standingChanges = new[] { new MissionStandingChange(positiveAllianceEid, standingValue), new MissionStandingChange(opposingAllianceEid, negativeValue) };
+ }
}
}
diff --git a/src/Perpetuum/Services/RiftSystem/Rift.cs b/src/Perpetuum/Services/RiftSystem/Rift.cs
index ff9e047f5..e0c710fae 100644
--- a/src/Perpetuum/Services/RiftSystem/Rift.cs
+++ b/src/Perpetuum/Services/RiftSystem/Rift.cs
@@ -131,6 +131,8 @@ public Rift(ITeleportStrategyFactories teleportStrategyFactories)
_blobEmitter = new BlobEmitter(this);
}
+ public bool IsDestinationStronghold { get; set; } = false;
+
public void SetDespawnTime(TimeSpan despawnTime)
{
_despawnHelper = UnitDespawnHelper.Create(this,despawnTime);
@@ -175,17 +177,30 @@ public void UseItem(Player player)
{
player.HasTeleportSicknessEffect.ThrowIfTrue(ErrorCodes.TeleportTimerStillRunning);
player.HasPvpEffect.ThrowIfTrue(ErrorCodes.CantBeUsedInPvp);
- player.CurrentPosition.IsInRangeOf3D(CurrentPosition, 8).ThrowIfFalse(ErrorCodes.TeleportOutOfRange);
- var nearestRift = Zone.Units.OfType().Where(rift => rift != this).GetNearestUnit(CurrentPosition);
- if (nearestRift == null)
- throw new PerpetuumException(ErrorCodes.WTFErrorMedicalAttentionSuggested);
+ IZone destination = player.Character.GetZone(16);
- var teleport = _teleportStrategyFactories.TeleportWithinZoneFactory();
- teleport.TargetPosition = nearestRift.CurrentPosition;
- teleport.ApplyTeleportSickness = true;
- teleport.ApplyInvulnerable = true;
- teleport.DoTeleportAsync(player);
+ // teleport player to stronghold
+ // stronghold zone must be active.
+ if (this.IsDestinationStronghold && destination != null)
+ {
+ var teleport = _teleportStrategyFactories.TeleportToAnotherZoneFactory(destination);
+ teleport.DoTeleportAsync(player);
+ }
+ else
+ {
+ player.CurrentPosition.IsInRangeOf3D(CurrentPosition, 8).ThrowIfFalse(ErrorCodes.TeleportOutOfRange);
+
+ var nearestRift = Zone.Units.OfType().Where(rift => rift != this).GetNearestUnit(CurrentPosition);
+ if (nearestRift == null)
+ throw new PerpetuumException(ErrorCodes.WTFErrorMedicalAttentionSuggested);
+
+ var teleport = _teleportStrategyFactories.TeleportWithinZoneFactory();
+ teleport.TargetPosition = nearestRift.CurrentPosition;
+ teleport.ApplyTeleportSickness = true;
+ teleport.ApplyInvulnerable = true;
+ teleport.DoTeleportAsync(player);
+ }
}
public double BlobEmission => _blobEmitter.BlobEmission;
diff --git a/src/Perpetuum/Services/RiftSystem/RiftManager.cs b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
index 4662b4aac..489f3ef73 100644
--- a/src/Perpetuum/Services/RiftSystem/RiftManager.cs
+++ b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
@@ -61,6 +61,8 @@ public class RiftManager
private readonly TimeRange _spawnTime;
private readonly RiftSpawnPositionFinder _spawnPositionFinder;
private readonly IEntityServices _entityServices;
+ private bool StrongHoldRiftGenerated { get; set; } = false;
+ private Random r;
private readonly LinkedList _nextRiftSpawns = new LinkedList();
@@ -70,18 +72,21 @@ public RiftManager(IZone zone,TimeRange spawnTime,RiftSpawnPositionFinder spawnP
_spawnTime = spawnTime;
_spawnPositionFinder = spawnPositionFinder;
_entityServices = entityServices;
+ r = new Random();
}
private int _riftCounts;
public void Update(TimeSpan time)
{
- while (_riftCounts < 20)
+ // FIXME: this needs to be in the database.
+ // do not spawn rifts on zone 16 (the stronghold)
+ while (_riftCounts < 10 && _zone.Id != 16)
{
_nextRiftSpawns.AddLast(new TimeTracker(FastRandom.NextTimeSpan(_spawnTime)));
Interlocked.Increment(ref _riftCounts);
}
-
+
_nextRiftSpawns.RemoveAll(t =>
{
t.Update(time);
@@ -100,9 +105,16 @@ private void SpawnRift()
rift.SetDespawnTime(TimeSpan.FromHours(3));
rift.RemovedFromZone += OnRiftRemovedFromZone;
+ // only generate one stronghold teleport and make it random chance.
+ int rand = r.Next(0, 10);
+ if (rand == 2 && !StrongHoldRiftGenerated)
+ {
+ rift.IsDestinationStronghold = true;
+ }
+
var spawnPosition = _spawnPositionFinder.FindSpawnPosition().ToPosition();
rift.AddToZone(_zone, spawnPosition, ZoneEnterType.NpcSpawn);
- Logger.Info("Rift spawned. " + rift.ED.Name + " (" + rift.CurrentPosition + ")");
+ Logger.Info("Rift spawned. " + rift.ED.Name + " (" + rift.CurrentPosition + ") Stronghold:" + rift.IsDestinationStronghold);
}
private void OnRiftRemovedFromZone(Unit unit)
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
index c65d76376..70481ad1b 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
@@ -3,6 +3,7 @@
using Perpetuum.Data;
using Perpetuum.EntityFramework;
using Perpetuum.Players;
+using Perpetuum.Zones.Finders.PositionFinders;
namespace Perpetuum.Zones.Teleporting.Strategies
{
@@ -37,5 +38,28 @@ public void DoTeleport(Player player)
Task.Delay(1000).ContinueWith(t => _targetZone.Enter(character,Commands.TeleportUse));
});
}
+
+ [CanBeNull]
+ public Task DoTeleportAsync(Player player)
+ {
+ // FIXME: this needs to calculate a proper position but the server does not have the altitude data for this map
+ var validPosition = new Position(1120, 1039);
+ player.States.Teleport = true;
+ Entity.Repository.ForceUpdate(player);
+ var character = player.Character;
+ character.ZoneId = _targetZone.Id;
+ character.ZonePosition = validPosition;
+
+ var task = Task.Delay(10).ContinueWith(t =>
+ {
+ player.RemoveFromZone();
+ player.CurrentSpeed = 0.0;
+ _targetZone.Enter(character, Commands.TeleportUse);
+ player.States.InMoveable = false;
+ player.States.LocalTeleport = false;
+ });
+
+ return task;
+ }
}
}
\ No newline at end of file
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs
index 3aa88de06..087c79cff 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportWithinZone.cs
@@ -53,8 +53,15 @@ public Task DoTeleportAsync(Player player)
player.AddToZone(zone,validPosition,ZoneEnterType.LocalTeleport);
player.SendInitSelf();
- if ( ApplyTeleportSickness )
+ if (ApplyTeleportSickness)
+ {
player.ApplyTeleportSicknessEffect();
+ }
+ if (ApplyInvulnerable)
+ {
+ player.RemoveInvulnerableEffect(); // remove previous effect.
+ player.ApplyInvulnerableEffect(); // re-add effect to restart counter.
+ }
// mozoghat, fade out
player.States.InMoveable = false;
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs
index e82e5d0c2..66fad4851 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs
@@ -14,7 +14,7 @@ namespace Perpetuum.Zones.Teleporting.Strategies
{
public class TrainingExitStrategy : ITeleportStrategy
{
- private const double CHARACTER_START_CREDIT = 20000;
+ private const double CHARACTER_START_CREDIT = 500000; //TODO: move to DB
private const int MAX_REWARD_LEVEL = 4;
private readonly TeleportDescription _description;
From 18b35b7a35d7bed54ba496ccb96cb7041d4407a8 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sun, 28 Jan 2018 19:50:00 -0500
Subject: [PATCH 017/457] Fix for #52 where production missions would not
advance. (#13)
---
src/Perpetuum/EntityFramework/Entity.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Perpetuum/EntityFramework/Entity.cs b/src/Perpetuum/EntityFramework/Entity.cs
index d2cabadb5..0012ba81a 100644
--- a/src/Perpetuum/EntityFramework/Entity.cs
+++ b/src/Perpetuum/EntityFramework/Entity.cs
@@ -84,7 +84,7 @@ public Entity ParentEntity
[CanBeNull]
public Entity GetOrLoadParentEntity()
{
- if (_parentEntity == null && Parent > 0)
+ if ((_parentEntity == null || _parentEntity.Eid <= 0) && Parent > 0)
{
_parentEntity = LoadParentEntity(Parent);
}
From e4f2c81cd37fd1ecfbd0f3f157fbeab94baeb443 Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Mon, 29 Jan 2018 18:33:35 -0500
Subject: [PATCH 018/457] add User-Agent to avoid being 403'd by current web
server (#14)
---
src/Perpetuum/Network/Http.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Perpetuum/Network/Http.cs b/src/Perpetuum/Network/Http.cs
index dc894e756..ceb6f79a3 100644
--- a/src/Perpetuum/Network/Http.cs
+++ b/src/Perpetuum/Network/Http.cs
@@ -13,9 +13,10 @@ public static string Post(string address, IEnumerable
Date: Mon, 29 Jan 2018 18:59:08 -0500
Subject: [PATCH 019/457] in-game command interface (#16)
* rudimentary in-game command interface
* more commands added.
* more layer editing abilities.
* bugged it!
---
.../Channels/ChannelTalk.cs | 2 +-
src/Perpetuum/Perpetuum.csproj | 1 +
src/Perpetuum/Services/Channels/Channel.cs | 3 +-
.../Services/Channels/ChannelManager.cs | 11 +-
.../Services/Channels/ChannelType.cs | 3 +-
.../Services/Channels/GameAdminCommands.cs | 493 ++++++++++++++++++
.../Services/Channels/IChannelManager.cs | 3 +-
src/Perpetuum/Services/Sessions/Session.cs | 22 +
src/Perpetuum/Zones/Locking/LockHandler.cs | 5 +-
9 files changed, 535 insertions(+), 8 deletions(-)
create mode 100644 src/Perpetuum/Services/Channels/GameAdminCommands.cs
diff --git a/src/Perpetuum.RequestHandlers/Channels/ChannelTalk.cs b/src/Perpetuum.RequestHandlers/Channels/ChannelTalk.cs
index 332a2cb7c..29c832752 100644
--- a/src/Perpetuum.RequestHandlers/Channels/ChannelTalk.cs
+++ b/src/Perpetuum.RequestHandlers/Channels/ChannelTalk.cs
@@ -18,7 +18,7 @@ public void HandleRequest(IRequest request)
var message = request.Data.GetOrDefault(k.message);
var character = request.Session.Character;
- _channelManager.Talk(channelName, character, message);
+ _channelManager.Talk(channelName, character, message, request);
Message.Builder.FromRequest(request).WithOk().Send();
}
}
diff --git a/src/Perpetuum/Perpetuum.csproj b/src/Perpetuum/Perpetuum.csproj
index b5178502b..957942098 100644
--- a/src/Perpetuum/Perpetuum.csproj
+++ b/src/Perpetuum/Perpetuum.csproj
@@ -276,6 +276,7 @@
+
diff --git a/src/Perpetuum/Services/Channels/Channel.cs b/src/Perpetuum/Services/Channels/Channel.cs
index 64269c297..9384e08f6 100644
--- a/src/Perpetuum/Services/Channels/Channel.cs
+++ b/src/Perpetuum/Services/Channels/Channel.cs
@@ -13,6 +13,7 @@ public class Channel
public string Name { get; private set; }
public string Topic { get; private set; }
public string Password { get; private set; }
+ public GameAdminCommands AdminCommands = new GameAdminCommands();
public IChannelLogger Logger { get; private set; }
@@ -198,7 +199,7 @@ public bool IsConstant
{
switch (Type)
{
- case ChannelType.Public:
+ case ChannelType.Public | ChannelType.Admin:
return false;
}
diff --git a/src/Perpetuum/Services/Channels/ChannelManager.cs b/src/Perpetuum/Services/Channels/ChannelManager.cs
index 985002f12..45c6cc3b7 100644
--- a/src/Perpetuum/Services/Channels/ChannelManager.cs
+++ b/src/Perpetuum/Services/Channels/ChannelManager.cs
@@ -5,6 +5,7 @@
using System.Threading;
using Perpetuum.Accounting.Characters;
using Perpetuum.Common.Loggers;
+using Perpetuum.Host.Requests;
using Perpetuum.Services.Sessions;
namespace Perpetuum.Services.Channels
@@ -249,7 +250,7 @@ public void SetMemberRole(string channelName, Character issuer,Character charact
channel.SendToAll(_sessionManager, n);
}
- public void Talk(string channelName, Character sender, string message)
+ public void Talk(string channelName, Character sender, string message, IRequest request)
{
Channel channel;
if ( !_channels.TryGetValue(channelName,out channel))
@@ -262,7 +263,13 @@ public void Talk(string channelName, Character sender, string message)
channel.Logger.LogMessage(sender, message);
m.CanTalk.ThrowIfFalse(ErrorCodes.CharacterIsMuted);
- channel.SendMessageToAll(_sessionManager,sender,message);
+ channel.SendMessageToAll(_sessionManager, sender, message);
+ // this is an admin or GM command sent on an admin channel.
+ if (message.Substring(0,1) == "#" && channel.Type == ChannelType.Admin)
+ {
+ channel.AdminCommands.ParseAdminCommand(sender, message, request, channel, _sessionManager);
+ }
+
}
public void KickOrBan(string channelName, Character issuer, Character character, string message, bool ban)
diff --git a/src/Perpetuum/Services/Channels/ChannelType.cs b/src/Perpetuum/Services/Channels/ChannelType.cs
index 3722f5f38..42326648a 100644
--- a/src/Perpetuum/Services/Channels/ChannelType.cs
+++ b/src/Perpetuum/Services/Channels/ChannelType.cs
@@ -6,6 +6,7 @@ public enum ChannelType
Highlighted,
Corporation,
Gang,
- Station
+ Station,
+ Admin
}
}
\ No newline at end of file
diff --git a/src/Perpetuum/Services/Channels/GameAdminCommands.cs b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
new file mode 100644
index 000000000..cf3f5e054
--- /dev/null
+++ b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
@@ -0,0 +1,493 @@
+using Perpetuum.Accounting.Characters;
+using Perpetuum.GenXY;
+using Perpetuum.Host.Requests;
+using Perpetuum.Services.Sessions;
+using Perpetuum.Zones.Locking.Locks;
+using Perpetuum.Zones.Terrains;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Perpetuum.Services.Channels
+{
+ public class GameAdminCommands
+ {
+ public GameAdminCommands()
+ {
+
+ }
+
+ // obviously everything coming in from the in-game chat is a string.
+ // we have to take that string and chop it up, work out what command is being executed
+ // then parse/cast/convert arguments as necessary.
+ public void ParseAdminCommand(Character sender, string text, IRequest request, Channel channel, ISessionManager sessionManager)
+ {
+ string[] command = text.Split(new char[] { ',' });
+
+ if (command[0] == "#shutdown")
+ {
+ DateTime shutdownin = DateTime.Now;
+ int minutes = 1;
+ if (!int.TryParse(command[2], out minutes))
+ {
+ throw PerpetuumException.Create(ErrorCodes.RequiredArgumentIsNotSpecified);
+ }
+ shutdownin = shutdownin.AddMinutes(minutes);
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "message", command[1] },
+ { "date", shutdownin }
+ };
+
+ string cmd = string.Format("serverShutDown:relay:{0}", GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#shutdowncancel")
+ {
+ string cmd = string.Format("serverShutDownCancel:relay:null");
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#jumpto")
+ {
+ bool err = false;
+ err = !int.TryParse(command[1], out int zone);
+ err = !int.TryParse(command[2], out int x);
+ err = !int.TryParse(command[3], out int y);
+ if (err)
+ {
+ throw PerpetuumException.Create(ErrorCodes.RequiredArgumentIsNotSpecified);
+ }
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "zoneID" , zone },
+ { "x" , x },
+ { "y" , y }
+ };
+
+ string cmd = string.Format("jumpAnywhere:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#moveplayer")
+ {
+ bool err = false;
+ err = !int.TryParse(command[1], out int characterID);
+ err = !int.TryParse(command[2], out int x);
+ err = !int.TryParse(command[3], out int y);
+ if (err)
+ {
+ throw PerpetuumException.Create(ErrorCodes.RequiredArgumentIsNotSpecified);
+ }
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "characterID" , characterID },
+ { "x" , x },
+ { "y" , y }
+ };
+
+ string cmd = string.Format("zoneMoveUnit:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#currentzonecleanobstacleblocking")
+ {
+ string cmd = string.Format("zoneCleanObstacleBlocking:zone_{0}:null", sender.ZoneId);
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#currentzonedrawblockingbyeid")
+ {
+ bool err = false;
+ err = !Int64.TryParse(command[1], out Int64 eid);
+
+ if (err)
+ {
+ throw PerpetuumException.Create(ErrorCodes.RequiredArgumentIsNotSpecified);
+ }
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "eid", eid }
+ };
+
+ string cmd = string.Format("zoneDrawBlockingByEid:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#currentzoneremoveobjectbyeid")
+ {
+ bool err = false;
+ err = !Int64.TryParse(command[1], out Int64 eid);
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "target", eid }
+ };
+
+ string cmd = string.Format("zoneRemoveObject:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#zonecreateisland")
+ {
+ bool err = false;
+ err = !int.TryParse(command[1], out int lvl);
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "low", lvl }
+ };
+
+ string cmd = string.Format("zoneCreateIsland:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#currentzoneplacewall")
+ {
+ string cmd = string.Format("zonePlaceWall:zone_{0}:null", sender.ZoneId);
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#currentzoneclearwalls")
+ {
+ string cmd = string.Format("zoneClearWalls:zone_{0}:null", sender.ZoneId);
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#currentzoneadddecor")
+ {
+ bool err = false;
+ err = !int.TryParse(command[1], out int definition);
+ err = !int.TryParse(command[2], out int x);
+ err = !int.TryParse(command[3], out int y);
+ err = !int.TryParse(command[4], out int z);
+ err = !double.TryParse(command[5], out double qx);
+ err = !double.TryParse(command[6], out double qy);
+ err = !double.TryParse(command[7], out double qz);
+ err = !double.TryParse(command[8], out double qw);
+ err = !double.TryParse(command[9], out double scale);
+ err = !int.TryParse(command[10], out int cat);
+
+ if (err)
+ {
+ throw PerpetuumException.Create(ErrorCodes.RequiredArgumentIsNotSpecified);
+ }
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "definition", definition },
+ { "x", x*255 },
+ { "y", y*255 },
+ { "z", z },
+ { "quaternionX", qx },
+ { "quaternionY", qy },
+ { "quaternionZ", qz },
+ { "quaternionW", qw },
+ { "scale", scale },
+ { "category", cat }
+ };
+
+ string cmd = string.Format("zoneDecorAdd:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#adddecortolockedtile")
+ {
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var terrainLock = player.GetPrimaryLock() as TerrainLock;
+ if (terrainLock == null)
+ {
+ return;
+ }
+
+ int x = terrainLock.Location.intX;
+ int y = terrainLock.Location.intY;
+ int z = terrainLock.Location.intZ;
+
+ bool err = !double.TryParse(command[2], out double scale);
+ err = !int.TryParse(command[1], out int definition);
+
+ if (err)
+ {
+ throw PerpetuumException.Create(ErrorCodes.RequiredArgumentIsNotSpecified);
+ }
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "definition", definition },
+ { "x", x*255 },
+ { "y", y*255 },
+ { "z", z*255 },
+ { "quaternionX", (double)0 },
+ { "quaternionY", (double)0 },
+ { "quaternionZ", (double)0 },
+ { "quaternionW", (double)0 },
+ { "scale", scale },
+ { "category", 1 }
+ };
+
+ string cmd = string.Format("zoneDecorAdd:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#zonedeletedecor")
+ {
+ bool err = false;
+ err = !int.TryParse(command[1], out int idno);
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "ID", idno }
+ };
+
+ string cmd = string.Format("zoneDecorDelete:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#zoneclearlayer")
+ {
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "layerName", command[1] }
+ };
+
+ string cmd = string.Format("zoneClearLayer:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#zonesetplantspeed")
+ {
+ bool err = false;
+ err = !int.TryParse(command[1], out int speed);
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "speed", speed }
+ };
+
+ string cmd = string.Format("zoneSetPlantsSpeed:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#zonesetplantmode")
+ {
+ Dictionary dictionary = new Dictionary()
+ {
+ { "mode", command[1] }
+ };
+
+ string cmd = string.Format("zoneSetPlantsMode:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#currentzonerestoreoriginalgamma")
+ {
+ string cmd = string.Format("zoneRestoreOriginalGamma:zone_{0}:null", sender.ZoneId);
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#zonedrawblockingbydefinition")
+ {
+ bool err = false;
+ err = !int.TryParse(command[1], out int def);
+ int[] defs = new int[1];
+ defs[0] = def;
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "definition", defs }
+ };
+
+ string cmd = string.Format("zoneDrawBlockingByDefinition:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+ if (command[0] == "#addblockingtotiles")
+ {
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var lockedtiles = player.GetLocks();
+
+ using (new TerrainUpdateMonitor(zone))
+ {
+ foreach (Lock item in lockedtiles)
+ {
+ Position pos = (item as TerrainLock).Location;
+ zone.Terrain.Blocks.SetValue(pos, new BlockingInfo() { Obstacle = true });
+ item.Cancel(); // cancel this lock. we processed it.
+ }
+ }
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Added Blocking To {0} Tiles.", lockedtiles.Count));
+ }
+
+ if (command[0] == "#removeblockingfromtiles")
+ {
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var lockedtiles = player.GetLocks();
+
+ using (new TerrainUpdateMonitor(zone))
+ {
+ foreach (Lock item in lockedtiles)
+ {
+ Position pos = (item as TerrainLock).Location;
+ zone.Terrain.Blocks.SetValue(pos, new BlockingInfo() { Obstacle = false });
+ item.Cancel(); // cancel this lock. we processed it.
+ }
+ }
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Removed Blocking From {0} Tiles.", lockedtiles.Count));
+ }
+
+ if (command[0] == "#zonedecorlock")
+ {
+
+ bool err = false;
+ err = !int.TryParse(command[1], out int id);
+ err = !int.TryParse(command[2], out int locked);
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "ID", id },
+ { "locked", locked }
+ };
+
+ string cmd = string.Format("zoneDecorLock:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+
+ }
+
+ if (command[0] == "#zonetileshighway")
+ {
+ bool.TryParse(command[1], out bool adddelete);
+ bool.TryParse(command[2], out bool keeplock);
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var lockedtiles = player.GetLocks();
+
+ using (new TerrainUpdateMonitor(zone))
+ {
+ foreach (Lock item in lockedtiles)
+ {
+ Position pos = (item as TerrainLock).Location;
+ TerrainControlInfo ti = zone.Terrain.Controls.GetValue(pos);
+ ti.Highway = adddelete;
+ zone.Terrain.Controls.SetValue(pos, ti);
+ if (!keeplock)
+ {
+ item.Cancel(); // cancel this lock. we processed it.
+ }
+ }
+ }
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Altered state of control layer on {0} Tiles (Highway)", lockedtiles.Count));
+ }
+
+ if (command[0] == "#zonetilesconcretea")
+ {
+ bool.TryParse(command[1], out bool adddelete);
+ bool.TryParse(command[2], out bool keeplock);
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var lockedtiles = player.GetLocks();
+
+ using (new TerrainUpdateMonitor(zone))
+ {
+ foreach (Lock item in lockedtiles)
+ {
+ Position pos = (item as TerrainLock).Location;
+ TerrainControlInfo ti = zone.Terrain.Controls.GetValue(pos);
+ ti.ConcreteA = adddelete;
+ zone.Terrain.Controls.SetValue(pos, ti);
+ if (!keeplock)
+ {
+ item.Cancel(); // cancel this lock. we processed it.
+ }
+ }
+ }
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Altered state of control layer on {0} Tiles (ConcreteA)", lockedtiles.Count));
+ }
+
+ if (command[0] == "#zonetilesconcreteb")
+ {
+
+ bool.TryParse(command[1], out bool adddelete);
+ bool.TryParse(command[2], out bool keeplock);
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var lockedtiles = player.GetLocks();
+
+ using (new TerrainUpdateMonitor(zone))
+ {
+ foreach (Lock item in lockedtiles)
+ {
+ Position pos = (item as TerrainLock).Location;
+ TerrainControlInfo ti = zone.Terrain.Controls.GetValue(pos);
+ ti.ConcreteB = adddelete;
+ zone.Terrain.Controls.SetValue(pos, ti);
+ if (!keeplock)
+ {
+ item.Cancel(); // cancel this lock. we processed it.
+ }
+ }
+ }
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Altered state of control layer on {0} Tiles (ConcreteB)", lockedtiles.Count));
+ }
+
+ if (command[0] == "#zonetilesroaming")
+ {
+
+ bool.TryParse(command[1], out bool adddelete);
+ bool.TryParse(command[2], out bool keeplock);
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var lockedtiles = player.GetLocks();
+
+ using (new TerrainUpdateMonitor(zone))
+ {
+ foreach (Lock item in lockedtiles)
+ {
+ Position pos = (item as TerrainLock).Location;
+ TerrainControlInfo ti = zone.Terrain.Controls.GetValue(pos);
+ ti.Roaming = adddelete;
+ zone.Terrain.Controls.SetValue(pos, ti);
+ if (!keeplock)
+ {
+ item.Cancel(); // cancel this lock. we processed it.
+ }
+ }
+ }
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Altered state of control layer on {0} Tiles (Roaming)", lockedtiles.Count));
+ }
+
+ }
+ }
+}
diff --git a/src/Perpetuum/Services/Channels/IChannelManager.cs b/src/Perpetuum/Services/Channels/IChannelManager.cs
index 8098be9f2..878933d00 100644
--- a/src/Perpetuum/Services/Channels/IChannelManager.cs
+++ b/src/Perpetuum/Services/Channels/IChannelManager.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Perpetuum.Accounting.Characters;
+using Perpetuum.Host.Requests;
namespace Perpetuum.Services.Channels
{
@@ -19,7 +20,7 @@ public interface IChannelManager
void SetMemberRole(string channelName, Character issuer, Character character, ChannelMemberRole role);
void SetPassword(string channelName, Character issuer, string password);
void SetTopic(string channelName, Character issuer, string topic);
- void Talk(string channelName, Character sender, string message);
+ void Talk(string channelName, Character sender, string message, IRequest request);
void KickOrBan(string channelName, Character issuer, Character character, string message, bool ban);
void UnBan(string channelName, Character issuer, Character character);
diff --git a/src/Perpetuum/Services/Sessions/Session.cs b/src/Perpetuum/Services/Sessions/Session.cs
index 50cd28f5a..913dfc95d 100644
--- a/src/Perpetuum/Services/Sessions/Session.cs
+++ b/src/Perpetuum/Services/Sessions/Session.cs
@@ -27,9 +27,13 @@ public interface ISession
bool IsAuthenticated { get; }
Character Character { get; }
AccessLevel AccessLevel { get; }
+ IZoneManager ZoneMgr { get; }
void SendMessage(MessageBuilder builder);
void SendMessage(IMessage message);
+ // to expose these to our chat command interface.
+ IRequest CreateLocalRequest(string data);
+ void HandleLocalRequest(IRequest request);
void Start();
@@ -101,6 +105,14 @@ public void Start()
_connection.Receive();
}
+ public IZoneManager ZoneMgr
+ {
+ get
+ {
+ return _zoneManager;
+ }
+ }
+
public SessionID Id { get; private set; }
public int AccountId { get; private set; }
@@ -312,6 +324,11 @@ private void OnDataReceived(ITcpConnection connection, byte[] receivedData)
}
}
+ public void HandleLocalRequest(IRequest request)
+ {
+ HandleRequest(request);
+ }
+
private void HandleRequest(IRequest request)
{
if (request is IZoneRequest zoneRequest)
@@ -328,6 +345,11 @@ private void HandleRequest(IRequest request)
requestHandler.HandleRequest(request);
}
+ public IRequest CreateLocalRequest(string data)
+ {
+ return CreateRequest(data);
+ }
+
private IRequest CreateRequest(string data)
{
var args = data.Split(':');
diff --git a/src/Perpetuum/Zones/Locking/LockHandler.cs b/src/Perpetuum/Zones/Locking/LockHandler.cs
index cebbfb070..e6c139678 100644
--- a/src/Perpetuum/Zones/Locking/LockHandler.cs
+++ b/src/Perpetuum/Zones/Locking/LockHandler.cs
@@ -151,8 +151,9 @@ private void ProcessNewLocks(IList locks)
{
if (locks.Any(l => l.Equals(newLock)))
continue;
-
- if (locks.Count >= MaxLockedTargets)
+ // if you are a tooladmin then lock up anything you want.
+ // this is easier than making special bots to work with terrain.
+ if (locks.Count >= MaxLockedTargets && _owner.GetCharacter().AccessLevel != AccessLevel.toolAdmin)
{
OnLockError(newLock,ErrorCodes.MaxLockedTargetExceed);
continue;
From 1331d567a107c806ff2e2c5e1cc4eb4e9c5bc022 Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Mon, 29 Jan 2018 18:59:18 -0500
Subject: [PATCH 020/457] add a windows service for the server. (#15)
---
Perpetuum.sln | 14 ++
.../PerpetuumBootstrapper.cs | 5 +
src/Perpetuum.ServerService/App.config | 18 +++
.../PerpServer.Designer.cs | 37 ++++++
src/Perpetuum.ServerService/PerpServer.cs | 81 ++++++++++++
.../Perpetuum.ServerService.csproj | 125 ++++++++++++++++++
src/Perpetuum.ServerService/Program.cs | 55 ++++++++
.../Properties/AssemblyInfo.cs | 36 +++++
.../Properties/Resources.Designer.cs | 63 +++++++++
.../Properties/Resources.resx | 120 +++++++++++++++++
.../Properties/Settings.Designer.cs | 35 +++++
.../Properties/Settings.settings | 9 ++
src/Perpetuum.ServerService/packages.config | 4 +
13 files changed, 602 insertions(+)
create mode 100644 src/Perpetuum.ServerService/App.config
create mode 100644 src/Perpetuum.ServerService/PerpServer.Designer.cs
create mode 100644 src/Perpetuum.ServerService/PerpServer.cs
create mode 100644 src/Perpetuum.ServerService/Perpetuum.ServerService.csproj
create mode 100644 src/Perpetuum.ServerService/Program.cs
create mode 100644 src/Perpetuum.ServerService/Properties/AssemblyInfo.cs
create mode 100644 src/Perpetuum.ServerService/Properties/Resources.Designer.cs
create mode 100644 src/Perpetuum.ServerService/Properties/Resources.resx
create mode 100644 src/Perpetuum.ServerService/Properties/Settings.Designer.cs
create mode 100644 src/Perpetuum.ServerService/Properties/Settings.settings
create mode 100644 src/Perpetuum.ServerService/packages.config
diff --git a/Perpetuum.sln b/Perpetuum.sln
index a4f3593a4..bab491d9c 100644
--- a/Perpetuum.sln
+++ b/Perpetuum.sln
@@ -26,6 +26,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perpetuum.AdminTool", "src\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perpetuum.Bootstrapper", "src\Perpetuum.Bootstrapper\Perpetuum.Bootstrapper.csproj", "{E113962C-AD5D-4F17-8D08-656221CBD2D4}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Perpetuum.ServerService", "src\Perpetuum.ServerService\Perpetuum.ServerService.csproj", "{9C77CE95-825E-4BB1-9129-66835BDB8C96}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -108,6 +110,18 @@ Global
{E113962C-AD5D-4F17-8D08-656221CBD2D4}.Release|x64.Build.0 = Release|Any CPU
{E113962C-AD5D-4F17-8D08-656221CBD2D4}.Release|x86.ActiveCfg = Release|Any CPU
{E113962C-AD5D-4F17-8D08-656221CBD2D4}.Release|x86.Build.0 = Release|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Debug|x64.Build.0 = Debug|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Debug|x86.Build.0 = Debug|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Release|x64.ActiveCfg = Release|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Release|x64.Build.0 = Release|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Release|x86.ActiveCfg = Release|Any CPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
index 137cd9ab7..7cdbd4aaa 100644
--- a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
+++ b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
@@ -218,6 +218,11 @@ public void Stop(TimeSpan delay)
m.Shutdown(delay);
}
+ public IContainer GetContainer()
+ {
+ return _container;
+ }
+
public void WaitForStop()
{
var are = new AutoResetEvent(false);
diff --git a/src/Perpetuum.ServerService/App.config b/src/Perpetuum.ServerService/App.config
new file mode 100644
index 000000000..56c89d4da
--- /dev/null
+++ b/src/Perpetuum.ServerService/App.config
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ C:\PerpetuumServer\data\
+
+
+
+
\ No newline at end of file
diff --git a/src/Perpetuum.ServerService/PerpServer.Designer.cs b/src/Perpetuum.ServerService/PerpServer.Designer.cs
new file mode 100644
index 000000000..5f66ce51d
--- /dev/null
+++ b/src/Perpetuum.ServerService/PerpServer.Designer.cs
@@ -0,0 +1,37 @@
+namespace Perpetuum.ServerService
+{
+ partial class PerpServer
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ components = new System.ComponentModel.Container();
+ this.ServiceName = "PerpServer";
+ }
+
+ #endregion
+ }
+}
diff --git a/src/Perpetuum.ServerService/PerpServer.cs b/src/Perpetuum.ServerService/PerpServer.cs
new file mode 100644
index 000000000..2c7eb4e06
--- /dev/null
+++ b/src/Perpetuum.ServerService/PerpServer.cs
@@ -0,0 +1,81 @@
+using Perpetuum.Bootstrapper;
+using System;
+using System.ComponentModel;
+using System.IO;
+using System.ServiceProcess;
+using System.Threading.Tasks;
+using Autofac;
+using Perpetuum.Host;
+using System.Threading;
+
+namespace Perpetuum.ServerService
+{
+ public partial class PerpServer : ServiceBase
+ {
+
+ public PerpServer()
+ {
+ InitializeComponent();
+ Bootstrapper = new PerpetuumBootstrapper();
+ base.CanShutdown = true;
+ base.CanStop = true;
+ }
+
+ PerpetuumBootstrapper Bootstrapper { get; set; }
+
+ protected override void OnStart(string[] args)
+ {
+ // assumes the server is in the default installation directory.
+ string gameroot = Properties.Settings.Default.GameRoot;
+
+ try
+ {
+ Bootstrapper.Init(gameroot);
+ }
+ catch
+ {
+ // we failed to init. no idea why. we need to log this.
+ // usual reasons are db connection failures because we are running as a user with no privs.
+ return;
+ }
+
+ // start a task for our server.
+ Task task = Task.Run((Action)StartServer);
+
+ }
+
+ protected override void OnStop()
+ {
+ StopServer();
+ }
+
+ // windows requests this when shutting down.
+ // need to make sure this is called.
+ protected override void OnShutdown()
+ {
+ StopServer();
+ }
+
+ public void StartServer()
+ {
+ Bootstrapper.Start();
+ Bootstrapper.WaitForStop();
+ }
+
+ private void StopServer()
+ {
+ Autofac.IContainer _container = Bootstrapper.GetContainer();
+
+ Bootstrapper.Stop();
+
+ // get the host container and check it's status.
+ // if we are running still or stopping we ask windows to not kill us.
+ var s = _container.Resolve();
+ while (s.State == HostState.Online || s.State == HostState.Stopping)
+ {
+ RequestAdditionalTime(10000); // ask for more time. Hope we get it.
+ }
+ Thread.Sleep(10000); // wait 10 seconds for their logging process to finish.
+ }
+ }
+}
diff --git a/src/Perpetuum.ServerService/Perpetuum.ServerService.csproj b/src/Perpetuum.ServerService/Perpetuum.ServerService.csproj
new file mode 100644
index 000000000..08acc9fcd
--- /dev/null
+++ b/src/Perpetuum.ServerService/Perpetuum.ServerService.csproj
@@ -0,0 +1,125 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {9C77CE95-825E-4BB1-9129-66835BDB8C96}
+ WinExe
+ Perpetuum.ServerService
+ Perpetuum.ServerService
+ v4.6.1
+ 512
+ true
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+ x64
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\..\packages\Autofac.4.6.1\lib\net45\Autofac.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Component
+
+
+ PerpServer.cs
+
+
+ Component
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ True
+ Settings.settings
+
+
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+ {E113962C-AD5D-4F17-8D08-656221CBD2D4}
+ Perpetuum.Bootstrapper
+
+
+ {8587A597-848E-497F-8036-3B6F8047EC45}
+ Perpetuum
+
+
+
+
+ PublicResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+ False
+ Microsoft .NET Framework 4.6.1 %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+
+
\ No newline at end of file
diff --git a/src/Perpetuum.ServerService/Program.cs b/src/Perpetuum.ServerService/Program.cs
new file mode 100644
index 000000000..61b7a4a29
--- /dev/null
+++ b/src/Perpetuum.ServerService/Program.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Configuration.Install;
+using System.Linq;
+using System.Reflection;
+using System.ServiceProcess;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Perpetuum.ServerService
+{
+ [RunInstaller(true)]
+ public class PerpServerInstaller : Installer
+ {
+ private ServiceInstaller serviceInstaller1;
+ private ServiceProcessInstaller processInstaller;
+
+ public PerpServerInstaller()
+ {
+ // Instantiate installer for process and service.
+ processInstaller = new ServiceProcessInstaller();
+ serviceInstaller1 = new ServiceInstaller();
+
+ // The service runs under the system account.
+ processInstaller.Account = ServiceAccount.LocalSystem;
+
+ // The service is started manually.
+ serviceInstaller1.StartType = ServiceStartMode.Manual;
+
+ // ServiceName must equal those on ServiceBase derived classes.
+ serviceInstaller1.ServiceName = "Perpetuum Server";
+
+ // Add installer to collection. Order is not important if more than one service.
+ Installers.Add(serviceInstaller1);
+ Installers.Add(processInstaller);
+ }
+ }
+
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ static void Main(string[] args)
+ {
+ ServiceBase[] ServicesToRun;
+ ServicesToRun = new ServiceBase[]
+ {
+ new PerpServer()
+ };
+ ServiceBase.Run(ServicesToRun);
+ }
+ }
+}
diff --git a/src/Perpetuum.ServerService/Properties/AssemblyInfo.cs b/src/Perpetuum.ServerService/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..d18b979fe
--- /dev/null
+++ b/src/Perpetuum.ServerService/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Perpetuum.ServerService")]
+[assembly: AssemblyDescription("Perpetuum Windows Server Service")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("The OpenPerpetuum Project")]
+[assembly: AssemblyProduct("Perpetuum.ServerService")]
+[assembly: AssemblyCopyright("Copyright © 2018 The OpenPerpetuum Project")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("9c77ce95-825e-4bb1-9129-66835bdb8c96")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/Perpetuum.ServerService/Properties/Resources.Designer.cs b/src/Perpetuum.ServerService/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..58f9c9d07
--- /dev/null
+++ b/src/Perpetuum.ServerService/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Perpetuum.ServerService.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Perpetuum.ServerService.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/src/Perpetuum.ServerService/Properties/Resources.resx b/src/Perpetuum.ServerService/Properties/Resources.resx
new file mode 100644
index 000000000..1af7de150
--- /dev/null
+++ b/src/Perpetuum.ServerService/Properties/Resources.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/src/Perpetuum.ServerService/Properties/Settings.Designer.cs b/src/Perpetuum.ServerService/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..43ce4cc26
--- /dev/null
+++ b/src/Perpetuum.ServerService/Properties/Settings.Designer.cs
@@ -0,0 +1,35 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Perpetuum.ServerService.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.5.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("C:\\PerpetuumServer\\data\\")]
+ public string GameRoot {
+ get {
+ return ((string)(this["GameRoot"]));
+ }
+ }
+ }
+}
diff --git a/src/Perpetuum.ServerService/Properties/Settings.settings b/src/Perpetuum.ServerService/Properties/Settings.settings
new file mode 100644
index 000000000..ae61c7ea2
--- /dev/null
+++ b/src/Perpetuum.ServerService/Properties/Settings.settings
@@ -0,0 +1,9 @@
+
+
+
+
+
+ C:\PerpetuumServer\data\
+
+
+
\ No newline at end of file
diff --git a/src/Perpetuum.ServerService/packages.config b/src/Perpetuum.ServerService/packages.config
new file mode 100644
index 000000000..1903d4393
--- /dev/null
+++ b/src/Perpetuum.ServerService/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
From dd7c9df983b94833d02c82b38b623288e17c1520 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Tue, 30 Jan 2018 10:55:01 -0500
Subject: [PATCH 021/457] Fix for shutdown cancel issue (#48)
---
src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs | 2 +-
src/Perpetuum/Host/HostShutDownManager.cs | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
index 7cdbd4aaa..8648aaf25 100644
--- a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
+++ b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
@@ -1582,7 +1582,7 @@ private void InitRelayManager()
_builder.RegisterType().SingleInstance().As();
- _builder.RegisterType();
+ _builder.RegisterType().SingleInstance();
_builder.RegisterType().As();
_builder.RegisterType();
diff --git a/src/Perpetuum/Host/HostShutDownManager.cs b/src/Perpetuum/Host/HostShutDownManager.cs
index 75f0f410e..5c7138f18 100644
--- a/src/Perpetuum/Host/HostShutDownManager.cs
+++ b/src/Perpetuum/Host/HostShutDownManager.cs
@@ -35,6 +35,9 @@ public void StopShutDown(Command command)
_isInShutDown = false;
_shutDownTime = default(DateTime);
+ // create the cancellation token, logs, etc.
+ CancelShutdown();
+
//send all clients the cancellation
SendToAll(command);
}
From c8ea122733b6b62513b8ad2d8acc22eba05c69bf Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Tue, 30 Jan 2018 21:40:47 -0500
Subject: [PATCH 022/457] improvements to commands / teleporting.
---
.../Services/Channels/GameAdminCommands.cs | 127 ++++++++++++++++--
.../Services/Sessions/ISessionManager.cs | 1 +
.../Services/Sessions/SessionManager.cs | 11 ++
.../Strategies/TeleportToAnotherZone.cs | 9 +-
4 files changed, 137 insertions(+), 11 deletions(-)
diff --git a/src/Perpetuum/Services/Channels/GameAdminCommands.cs b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
index cf3f5e054..8d9c25670 100644
--- a/src/Perpetuum/Services/Channels/GameAdminCommands.cs
+++ b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
@@ -3,7 +3,9 @@
using Perpetuum.Host.Requests;
using Perpetuum.Services.Sessions;
using Perpetuum.Zones.Locking.Locks;
+using Perpetuum.Zones.Teleporting.Strategies;
using Perpetuum.Zones.Terrains;
+using Perpetuum.Zones.Terrains.Materials.Plants;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -78,22 +80,47 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
{
bool err = false;
err = !int.TryParse(command[1], out int characterID);
- err = !int.TryParse(command[2], out int x);
- err = !int.TryParse(command[3], out int y);
+ err = !int.TryParse(command[2], out int zoneID);
+ err = !int.TryParse(command[3], out int x);
+ err = !int.TryParse(command[4], out int y);
if (err)
{
throw PerpetuumException.Create(ErrorCodes.RequiredArgumentIsNotSpecified);
}
+
+ // get the target character's session.
+ var charactersession = sessionManager.GetByCharacter(characterID);
- Dictionary dictionary = new Dictionary()
+ if (charactersession.Character.ZoneId == null)
{
- { "characterID" , characterID },
- { "x" , x },
- { "y" , y }
- };
+ channel.SendMessageToAll(sessionManager, sender, string.Format("ERR: Character with ID {0} does not have a zone. Are they docked?", characterID));
+ return;
+ }
+
+ // get destination zone.
+ var zone = request.Session.ZoneMgr.GetZone(zoneID);
- string cmd = string.Format("zoneMoveUnit:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
- request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ if (charactersession.Character.ZoneId == null)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("ERR: Invalid Zone ID {0}", zoneID));
+ return;
+ }
+
+ // get a teleporter object to teleport the player.
+ TeleportToAnotherZone tp = new TeleportToAnotherZone(zone);
+
+ // we need the player (robot, etc) to teleport on the origin zone
+ var player = request.Session.ZoneMgr.GetZone((int)charactersession.Character.ZoneId).GetPlayer(charactersession.Character.ActiveRobotEid);
+ //var player = zone.GetPlayer(charactersession.Character.Eid);
+
+ // set the position.
+ tp.TargetPosition = new Position(x, y);
+
+ // do it.
+ tp.DoTeleportAsync(player);
+ tp = null;
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Moved Character {0}-{1} to Zone {2} @ {3},{4}", characterID, charactersession.Character.Nick, zone.Id, x, y));
}
if (command[0] == "#currentzonecleanobstacleblocking")
@@ -488,6 +515,88 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
channel.SendMessageToAll(sessionManager, sender, string.Format("Altered state of control layer on {0} Tiles (Roaming)", lockedtiles.Count));
}
+ if (command[0] == "#zonetilesPBSTerraformProtected")
+ {
+
+ bool.TryParse(command[1], out bool adddelete);
+ bool.TryParse(command[2], out bool keeplock);
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var lockedtiles = player.GetLocks();
+
+ using (new TerrainUpdateMonitor(zone))
+ {
+ foreach (Lock item in lockedtiles)
+ {
+ Position pos = (item as TerrainLock).Location;
+ TerrainControlInfo ti = zone.Terrain.Controls.GetValue(pos);
+ ti.PBSTerraformProtected = adddelete;
+ zone.Terrain.Controls.SetValue(pos, ti);
+ if (!keeplock)
+ {
+ item.Cancel(); // cancel this lock. we processed it.
+ }
+ }
+ }
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Altered state of control layer on {0} Tiles (PBSTerraformProtected)", lockedtiles.Count));
+ }
+
+ if (command[0] == "#getlockedtileproperties")
+ {
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var lockedtile = player.GetPrimaryLock();
+
+ TerrainControlInfo ti = zone.Terrain.Controls.GetValue((lockedtile as TerrainLock).Location);
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Tile at {0},{1} has the following flags..", (lockedtile as TerrainLock).Location.X, (lockedtile as TerrainLock).Location.Y));
+ channel.SendMessageToAll(sessionManager, sender, "TerrainControlFlags:");
+ foreach (TerrainControlFlags f in Enum.GetValues(typeof(TerrainControlFlags)))
+ {
+ if (ti.Flags.HasFlag(f) && f != TerrainControlFlags.Undefined)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("{0}", f.ToString()));
+ }
+ }
+
+ BlockingInfo bi = zone.Terrain.Blocks.GetValue((lockedtile as TerrainLock).Location);
+
+ channel.SendMessageToAll(sessionManager, sender, "BlockingFlags:");
+ foreach (BlockingFlags f in Enum.GetValues(typeof(BlockingFlags)))
+ {
+ if (bi.Flags.HasFlag(f) && f != BlockingFlags.Undefined)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("{0}", f.ToString()));
+ }
+ }
+
+ PlantInfo pi = zone.Terrain.Plants.GetValue((lockedtile as TerrainLock).Location);
+
+ channel.SendMessageToAll(sessionManager, sender, "PlantType:");
+ foreach (PlantType f in Enum.GetValues(typeof(PlantType)))
+ {
+ if (pi.type.HasFlag(f) && f != PlantType.NotDefined)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("{0}", f.ToString()));
+ }
+ }
+
+ channel.SendMessageToAll(sessionManager, sender, "GroundType:");
+ foreach (GroundType f in Enum.GetValues(typeof(GroundType)))
+ {
+ if (pi.groundType.HasFlag(f))
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("{0}", f.ToString()));
+ }
+ }
+
+ }
}
}
}
diff --git a/src/Perpetuum/Services/Sessions/ISessionManager.cs b/src/Perpetuum/Services/Sessions/ISessionManager.cs
index e80237497..7767cec46 100644
--- a/src/Perpetuum/Services/Sessions/ISessionManager.cs
+++ b/src/Perpetuum/Services/Sessions/ISessionManager.cs
@@ -10,6 +10,7 @@ public interface ISessionManager
ISession GetByCharacter(Character character);
ISession GetByAccount(Account account);
ISession GetByAccount(int accountId);
+ ISession GetByCharacter(int characterid);
IEnumerable Sessions { get;}
IEnumerable SelectedCharacters { get; }
bool Contains(SessionID sessionId);
diff --git a/src/Perpetuum/Services/Sessions/SessionManager.cs b/src/Perpetuum/Services/Sessions/SessionManager.cs
index 17569a73d..6a73d9d4e 100644
--- a/src/Perpetuum/Services/Sessions/SessionManager.cs
+++ b/src/Perpetuum/Services/Sessions/SessionManager.cs
@@ -169,6 +169,17 @@ public ISession GetByAccount(int accountId)
return _sessions.Values.FirstOrDefault(s => s.AccountId == accountId);
}
+ [CanBeNull]
+ public ISession GetByCharacter(int characterid)
+ {
+ if (characterid == 0)
+ {
+ return null;
+ }
+ return _sessions.Values.FirstOrDefault(s => s.Character.Id == characterid);
+ }
+
+
public bool IsOnline(Character character)
{
return _charactersIndex.ContainsKey(character);
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
index 70481ad1b..d17df43d9 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
@@ -42,8 +42,13 @@ public void DoTeleport(Player player)
[CanBeNull]
public Task DoTeleportAsync(Player player)
{
- // FIXME: this needs to calculate a proper position but the server does not have the altitude data for this map
- var validPosition = new Position(1120, 1039);
+ // get a valid position to teleport to.
+ var position = new ClosestWalkablePositionFinder(_targetZone, TargetPosition);
+ if (!position.Find(out Position validPosition))
+ {
+ return null;
+ }
+
player.States.Teleport = true;
Entity.Repository.ForceUpdate(player);
var character = player.Character;
From 56071e822f031d13e4b1abeeadda3141f627f556 Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Tue, 30 Jan 2018 23:27:22 -0500
Subject: [PATCH 023/457] release build x64 (#17)
---
src/Perpetuum.ServerService/Perpetuum.ServerService.csproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Perpetuum.ServerService/Perpetuum.ServerService.csproj b/src/Perpetuum.ServerService/Perpetuum.ServerService.csproj
index 08acc9fcd..a226ff8d8 100644
--- a/src/Perpetuum.ServerService/Perpetuum.ServerService.csproj
+++ b/src/Perpetuum.ServerService/Perpetuum.ServerService.csproj
@@ -38,7 +38,7 @@
4
- AnyCPU
+ x64
pdbonly
true
bin\Release\
From a6f5abfdc5c34972707296cc1759b90603455b13 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Wed, 31 Jan 2018 20:58:16 -0500
Subject: [PATCH 024/457] improvements to the command interface
---
.../Zone/StatsMapDrawing/ZoneDrawStatMap.cs | 6 +-
src/Perpetuum/Players/Player.cs | 1 +
src/Perpetuum/Services/Channels/Channel.cs | 25 +++-
.../Services/Channels/ChannelManager.cs | 8 +-
.../Services/Channels/ChannelRepository.cs | 5 +-
.../Services/Channels/GameAdminCommands.cs | 127 +++++++++++++++++-
src/Perpetuum/Units/Unit.Visibility.cs | 8 +-
7 files changed, 162 insertions(+), 18 deletions(-)
diff --git a/src/Perpetuum.RequestHandlers/Zone/StatsMapDrawing/ZoneDrawStatMap.cs b/src/Perpetuum.RequestHandlers/Zone/StatsMapDrawing/ZoneDrawStatMap.cs
index 6f8ffe41d..791b1f2d6 100644
--- a/src/Perpetuum.RequestHandlers/Zone/StatsMapDrawing/ZoneDrawStatMap.cs
+++ b/src/Perpetuum.RequestHandlers/Zone/StatsMapDrawing/ZoneDrawStatMap.cs
@@ -25,16 +25,15 @@ namespace Perpetuum.RequestHandlers.Zone.StatsMapDrawing
{
public partial class ZoneDrawStatMap : IRequestHandler
{
- private readonly IZone _zone;
+ private IZone _zone;
private readonly IFileSystem _fileSystem;
private readonly SaveBitmapHelper _saveBitmapHelper;
private readonly MissionDataCache _missionDataCache;
private readonly Dictionary> _actions = new Dictionary>();
private string _typeString;
- public ZoneDrawStatMap(IZone zone,IFileSystem fileSystem,SaveBitmapHelper saveBitmapHelper,MissionDataCache missionDataCache)
+ public ZoneDrawStatMap(IFileSystem fileSystem,SaveBitmapHelper saveBitmapHelper,MissionDataCache missionDataCache)
{
- _zone = zone;
_fileSystem = fileSystem;
_saveBitmapHelper = saveBitmapHelper;
_missionDataCache = missionDataCache;
@@ -86,6 +85,7 @@ private void CreateAndSave(string postfix,Func bitmapFactory)
public void HandleRequest(IZoneRequest request)
{
+ _zone = request.Zone;
var type = request.Data.GetOrDefault(k.type);
_typeString = type; //save for later use
diff --git a/src/Perpetuum/Players/Player.cs b/src/Perpetuum/Players/Player.cs
index 68472e8e5..203bcd4a8 100644
--- a/src/Perpetuum/Players/Player.cs
+++ b/src/Perpetuum/Players/Player.cs
@@ -156,6 +156,7 @@ public Player(IExtensionReader extensionReader,ICorporationManager corporationMa
public long CorporationEid { get; set; }
public IZoneSession Session { get; private set; }
public Character Character { get; set; } = Character.None;
+ public bool HasGMStealth { get; set; }
public void SetSession(IZoneSession session)
{
diff --git a/src/Perpetuum/Services/Channels/Channel.cs b/src/Perpetuum/Services/Channels/Channel.cs
index 9384e08f6..cca52d9ac 100644
--- a/src/Perpetuum/Services/Channels/Channel.cs
+++ b/src/Perpetuum/Services/Channels/Channel.cs
@@ -6,7 +6,7 @@ namespace Perpetuum.Services.Channels
{
public class Channel
{
- private Dictionary _members = new Dictionary();
+ private Dictionary _members = new Dictionary();
public int Id { get; private set; }
public ChannelType Type { get; private set; }
@@ -19,17 +19,17 @@ public class Channel
private Channel()
{
-
+
}
- public Channel(int id,ChannelType type,string name,string topic,string password,IChannelLogger logger) : this(type,name,logger)
+ public Channel(int id, ChannelType type, string name, string topic, string password, IChannelLogger logger) : this(type, name, logger)
{
Id = id;
Topic = topic;
Password = password;
}
- public Channel(ChannelType type, string name,IChannelLogger logger)
+ public Channel(ChannelType type, string name, IChannelLogger logger)
{
Type = type;
Name = name;
@@ -61,7 +61,7 @@ public Channel SetId(int id)
public Channel SetTopic(string topic)
{
- if ( !string.IsNullOrEmpty(topic) && topic.Length > 200)
+ if (!string.IsNullOrEmpty(topic) && topic.Length > 200)
topic = topic.Substring(0, 199);
if (topic == Topic)
@@ -101,7 +101,7 @@ public Channel SetMember(ChannelMember member)
if (member == null)
return this;
- var members = new Dictionary(_members) {[member.character] = member};
+ var members = new Dictionary(_members) { [member.character] = member };
return new Channel
{
@@ -115,6 +115,19 @@ public Channel SetMember(ChannelMember member)
};
}
+ public void SetAdmin(bool isadminchannel)
+ {
+ if (isadminchannel)
+ {
+ this.Type = ChannelType.Admin;
+ }
+ else
+ {
+ this.Type = ChannelType.Public;
+ }
+ }
+
+
public Channel RemoveMember(Character member)
{
var members = new Dictionary(_members);
diff --git a/src/Perpetuum/Services/Channels/ChannelManager.cs b/src/Perpetuum/Services/Channels/ChannelManager.cs
index 45c6cc3b7..69902afdf 100644
--- a/src/Perpetuum/Services/Channels/ChannelManager.cs
+++ b/src/Perpetuum/Services/Channels/ChannelManager.cs
@@ -264,12 +264,12 @@ public void Talk(string channelName, Character sender, string message, IRequest
m.CanTalk.ThrowIfFalse(ErrorCodes.CharacterIsMuted);
channel.SendMessageToAll(_sessionManager, sender, message);
- // this is an admin or GM command sent on an admin channel.
- if (message.Substring(0,1) == "#" && channel.Type == ChannelType.Admin)
+ // this is an admin or GM command.
+ if (message.Substring(0, 1) == "#" && sender.AccessLevel == AccessLevel.toolAdmin)
{
- channel.AdminCommands.ParseAdminCommand(sender, message, request, channel, _sessionManager);
+ channel.AdminCommands.ParseAdminCommand(sender, message, request, channel, _sessionManager, this);
}
-
+
}
public void KickOrBan(string channelName, Character issuer, Character character, string message, bool ban)
diff --git a/src/Perpetuum/Services/Channels/ChannelRepository.cs b/src/Perpetuum/Services/Channels/ChannelRepository.cs
index 1d69b16d9..afcc54344 100644
--- a/src/Perpetuum/Services/Channels/ChannelRepository.cs
+++ b/src/Perpetuum/Services/Channels/ChannelRepository.cs
@@ -34,10 +34,11 @@ public void Delete(Channel channel)
public void Update(Channel channel)
{
- Db.Query().CommandText("update channels set topic = @topic,password = @password where id = @channelid")
+ Db.Query().CommandText("update channels set topic = @topic, password = @password, type=@type where id = @channelid")
.SetParameter("@topic", channel.Topic)
.SetParameter("@password", channel.Password)
- .SetParameter("@channelid",channel.Id)
+ .SetParameter("@type", channel.Type)
+ .SetParameter("@channelid",channel.Id)
.ExecuteNonQuery().ThrowIfEqual(0, ErrorCodes.SQLUpdateError);
}
diff --git a/src/Perpetuum/Services/Channels/GameAdminCommands.cs b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
index 8d9c25670..459f93872 100644
--- a/src/Perpetuum/Services/Channels/GameAdminCommands.cs
+++ b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
@@ -1,7 +1,10 @@
using Perpetuum.Accounting.Characters;
+using Perpetuum.ExportedTypes;
using Perpetuum.GenXY;
using Perpetuum.Host.Requests;
+using Perpetuum.Players;
using Perpetuum.Services.Sessions;
+using Perpetuum.Zones;
using Perpetuum.Zones.Locking.Locks;
using Perpetuum.Zones.Teleporting.Strategies;
using Perpetuum.Zones.Terrains;
@@ -24,10 +27,26 @@ public GameAdminCommands()
// obviously everything coming in from the in-game chat is a string.
// we have to take that string and chop it up, work out what command is being executed
// then parse/cast/convert arguments as necessary.
- public void ParseAdminCommand(Character sender, string text, IRequest request, Channel channel, ISessionManager sessionManager)
+ public void ParseAdminCommand(Character sender, string text, IRequest request, Channel channel, ISessionManager sessionManager, ChannelManager channelmanager)
{
string[] command = text.Split(new char[] { ',' });
+ // channel is not secured. must be secured first.
+ if (channel.Type != ChannelType.Admin)
+ {
+
+ if (command[0] == "#secure")
+ {
+ channel.SetAdmin(true);
+ channel.SendMessageToAll(sessionManager, sender, "Channel Secured.");
+ return;
+ }
+
+ channel.SendMessageToAll(sessionManager, sender, "Channel must be secured before sending commands.");
+ return;
+ }
+
+
if (command[0] == "#shutdown")
{
DateTime shutdownin = DateTime.Now;
@@ -122,7 +141,7 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
channel.SendMessageToAll(sessionManager, sender, string.Format("Moved Character {0}-{1} to Zone {2} @ {3},{4}", characterID, charactersession.Character.Nick, zone.Id, x, y));
}
-
+#if DEBUG
if (command[0] == "#currentzonecleanobstacleblocking")
{
string cmd = string.Format("zoneCleanObstacleBlocking:zone_{0}:null", sender.ZoneId);
@@ -544,6 +563,28 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
channel.SendMessageToAll(sessionManager, sender, string.Format("Altered state of control layer on {0} Tiles (PBSTerraformProtected)", lockedtiles.Count));
}
+#endif
+
+ if (command[0] == "#giveitem")
+ {
+
+ int.TryParse(command[1], out int definition);
+ int.TryParse(command[2], out int qty);
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "definition", definition },
+ { "quantity", qty }
+ };
+
+
+ string cmd = string.Format("createItem:relay:{0}", GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Gave Item {0} ", definition));
+ }
+
+
if (command[0] == "#getlockedtileproperties")
{
@@ -597,6 +638,88 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
}
}
+
+ if (command[0] == "#setvisibility")
+ {
+
+ bool.TryParse(command[1], out bool visiblestate);
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ player.HasGMStealth = !visiblestate;
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Player {0} visibility is {1}", player.Character.Nick, visiblestate));
+ }
+
+ if (command[0] == "#zonedrawstatmap")
+ {
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "type", command[1] }
+ };
+
+ string cmd = string.Format("zoneDrawStatMap:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+
+ if (command[0] == "#listplayersinzone")
+ {
+
+ int.TryParse(command[1], out int zoneid);
+
+ var zone = request.Session.ZoneMgr.GetZone((int)zoneid);
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Players On Zone {0}", zone.Id));
+ channel.SendMessageToAll(sessionManager, sender, string.Format(" AccountId CharacterId Nick Access Level Docked? DockedAt Position"));
+ foreach (Character c in sessionManager.SelectedCharacters)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format(" {0} {1} {2} {3} {4} {5} {6}",
+ c.AccountId, c.Id, c.Nick, c.AccessLevel, c.IsDocked, c.GetCurrentDockingBase().Eid, c.ZonePosition));
+ }
+ }
+
+ if (command[0] == "#countofplayers")
+ {
+ foreach (IZone z in request.Session.ZoneMgr.Zones)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Players On Zone {0}: {1}", z.Id, z.Players.ToList().Count));
+ }
+ }
+
+ if (command[0] == "#unsecure")
+ {
+ channel.SetAdmin(false);
+ channel.SendMessageToAll(sessionManager, sender, "Channel is now public.");
+ }
+
+ if (command[0] == "#addtochannel")
+ {
+ int.TryParse(command[1], out int characterid);
+
+ var c = sessionManager.GetByCharacter(characterid);
+
+ channelmanager.JoinChannel(channel.Name, c.Character, ChannelMemberRole.Operator, string.Empty);
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Added character {0} to channel ", c.Character.Nick));
+
+ }
+
+ if (command[0] == "#removefromchannel")
+ {
+ int.TryParse(command[1], out int characterid);
+
+ var c = sessionManager.GetByCharacter(characterid);
+
+ channelmanager.LeaveChannel(channel.Name, c.Character);
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Removed character {0} from channel ", c.Character.Nick));
+
+ }
+
}
}
}
diff --git a/src/Perpetuum/Units/Unit.Visibility.cs b/src/Perpetuum/Units/Unit.Visibility.cs
index 00475b041..acec40221 100644
--- a/src/Perpetuum/Units/Unit.Visibility.cs
+++ b/src/Perpetuum/Units/Unit.Visibility.cs
@@ -57,8 +57,14 @@ protected void UpdateVisibility(Unit target)
if (InZone && target.InZone)
{
- if ( IsDetected(target) )
+ if (target.IsPlayer() && (target as Player).HasGMStealth)
+ {
+ visibility = Visibility.Invisible;
+ }
+ else if (IsDetected(target))
+ {
visibility = Visibility.Visible;
+ }
}
UnitVisibility info;
From 58fc15a834f4fe44b4f0c592b9fa856737195aab Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Fri, 2 Feb 2018 23:35:24 -0500
Subject: [PATCH 025/457] we have to teleport someplace!
---
src/Perpetuum/Services/RiftSystem/Rift.cs | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Perpetuum/Services/RiftSystem/Rift.cs b/src/Perpetuum/Services/RiftSystem/Rift.cs
index e0c710fae..55bf41b01 100644
--- a/src/Perpetuum/Services/RiftSystem/Rift.cs
+++ b/src/Perpetuum/Services/RiftSystem/Rift.cs
@@ -185,6 +185,7 @@ public void UseItem(Player player)
if (this.IsDestinationStronghold && destination != null)
{
var teleport = _teleportStrategyFactories.TeleportToAnotherZoneFactory(destination);
+ teleport.TargetPosition = new Position(1120, 1039);
teleport.DoTeleportAsync(player);
}
else
From ed44946371d4afeba93205e7a2ead91cf9bbab45 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sat, 3 Feb 2018 13:00:28 -0500
Subject: [PATCH 026/457] rift system + stronghold overhaul.
---
.../PerpetuumBootstrapper.cs | 2 +
src/Perpetuum/Modules/Weapons/WeaponModule.cs | 6 +++
src/Perpetuum/Perpetuum.csproj | 1 +
src/Perpetuum/Services/RiftSystem/Rift.cs | 30 +++++++++++---
.../Services/RiftSystem/RiftManager.cs | 40 ++++++++++++++-----
src/Perpetuum/Zones/StrongHoldZone.cs | 17 ++++++++
src/Perpetuum/Zones/ZoneType.cs | 3 +-
7 files changed, 83 insertions(+), 16 deletions(-)
create mode 100644 src/Perpetuum/Zones/StrongHoldZone.cs
diff --git a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
index 7cdbd4aaa..8a4a95651 100644
--- a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
+++ b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
@@ -2354,6 +2354,8 @@ void RegisterZone(ZoneType type) where T:Zone
RegisterZone(ZoneType.Pve);
RegisterZone(ZoneType.Pvp);
RegisterZone(ZoneType.Training);
+ RegisterZone(ZoneType.Stronghold);
+
_builder.RegisterType();
_builder.RegisterType();
diff --git a/src/Perpetuum/Modules/Weapons/WeaponModule.cs b/src/Perpetuum/Modules/Weapons/WeaponModule.cs
index 2c4d80c14..6b969fdac 100644
--- a/src/Perpetuum/Modules/Weapons/WeaponModule.cs
+++ b/src/Perpetuum/Modules/Weapons/WeaponModule.cs
@@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Perpetuum.EntityFramework;
using Perpetuum.ExportedTypes;
+using Perpetuum.Services.RiftSystem;
using Perpetuum.Units;
using Perpetuum.Zones;
using Perpetuum.Zones.Beams;
@@ -77,6 +78,11 @@ public void VisitUnitLock(UnitLock unitLock)
victim.IsInvulnerable.ThrowIfTrue(ErrorCodes.TargetIsInvulnerable);
+ if (victim is Rift && (_weapon.ParentRobot.Zone is StrongHoldZone))
+ {
+ throw new PerpetuumException(ErrorCodes.TargetIsNonAttackable);
+ }
+
_weapon.ConsumeAmmo();
var result = _weapon.GetLineOfSight(victim);
diff --git a/src/Perpetuum/Perpetuum.csproj b/src/Perpetuum/Perpetuum.csproj
index 957942098..1aa75cab3 100644
--- a/src/Perpetuum/Perpetuum.csproj
+++ b/src/Perpetuum/Perpetuum.csproj
@@ -842,6 +842,7 @@
+
diff --git a/src/Perpetuum/Services/RiftSystem/Rift.cs b/src/Perpetuum/Services/RiftSystem/Rift.cs
index 55bf41b01..f4579ed18 100644
--- a/src/Perpetuum/Services/RiftSystem/Rift.cs
+++ b/src/Perpetuum/Services/RiftSystem/Rift.cs
@@ -12,6 +12,7 @@
using Perpetuum.Zones;
using Perpetuum.Zones.Blobs.BlobEmitters;
using Perpetuum.Zones.NpcSystem.Presences;
+using Perpetuum.Zones.Teleporting;
using Perpetuum.Zones.Teleporting.Strategies;
namespace Perpetuum.Services.RiftSystem
@@ -131,7 +132,8 @@ public Rift(ITeleportStrategyFactories teleportStrategyFactories)
_blobEmitter = new BlobEmitter(this);
}
- public bool IsDestinationStronghold { get; set; } = false;
+ public int DestinationStrongholdZone { get; set; }
+ public int OriginZone { get; set; }
public void SetDespawnTime(TimeSpan despawnTime)
{
@@ -178,14 +180,30 @@ public void UseItem(Player player)
player.HasTeleportSicknessEffect.ThrowIfTrue(ErrorCodes.TeleportTimerStillRunning);
player.HasPvpEffect.ThrowIfTrue(ErrorCodes.CantBeUsedInPvp);
- IZone destination = player.Character.GetZone(16);
+
+ // we are on a stronghold. we want to go home.
+ // for the moment we will send them to a teleporter on zone 0.
+ if (player.Zone is StrongHoldZone)
+ {
+ var destZone = player.Character.GetZone(0);
+ var teleportColumns = destZone.GetTeleportColumns().Where(t => t.IsEnabled);
+ var teleport = _teleportStrategyFactories.TeleportToAnotherZoneFactory(destZone);
+ teleport.TargetPosition = teleportColumns.First().CurrentPosition;
+ teleport.DoTeleportAsync(player);
+ return;
+ }
// teleport player to stronghold
// stronghold zone must be active.
- if (this.IsDestinationStronghold && destination != null)
+ if (this.DestinationStrongholdZone > 0)
{
- var teleport = _teleportStrategyFactories.TeleportToAnotherZoneFactory(destination);
- teleport.TargetPosition = new Position(1120, 1039);
+ var destZone = player.Character.GetZone(DestinationStrongholdZone);
+ var teleport = _teleportStrategyFactories.TeleportToAnotherZoneFactory(destZone);
+ // there should only be one, for now.
+ // FIXME: some zones may have more than one stronghold.
+ // we will need to link anomalies like teleporters.
+ var pos = destZone.Units.OfType().First();
+ teleport.TargetPosition = pos.CurrentPosition;
teleport.DoTeleportAsync(player);
}
else
@@ -194,7 +212,9 @@ public void UseItem(Player player)
var nearestRift = Zone.Units.OfType().Where(rift => rift != this).GetNearestUnit(CurrentPosition);
if (nearestRift == null)
+ {
throw new PerpetuumException(ErrorCodes.WTFErrorMedicalAttentionSuggested);
+ }
var teleport = _teleportStrategyFactories.TeleportWithinZoneFactory();
teleport.TargetPosition = nearestRift.CurrentPosition;
diff --git a/src/Perpetuum/Services/RiftSystem/RiftManager.cs b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
index 489f3ef73..cbe99cf50 100644
--- a/src/Perpetuum/Services/RiftSystem/RiftManager.cs
+++ b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
+using System.Linq;
using System.Threading;
using Perpetuum.EntityFramework;
using Perpetuum.ExportedTypes;
@@ -61,17 +62,19 @@ public class RiftManager
private readonly TimeRange _spawnTime;
private readonly RiftSpawnPositionFinder _spawnPositionFinder;
private readonly IEntityServices _entityServices;
+ private readonly ZoneManager _zonemanager;
private bool StrongHoldRiftGenerated { get; set; } = false;
private Random r;
private readonly LinkedList _nextRiftSpawns = new LinkedList();
- public RiftManager(IZone zone,TimeRange spawnTime,RiftSpawnPositionFinder spawnPositionFinder,IEntityServices entityServices)
+ public RiftManager(IZone zone,TimeRange spawnTime,RiftSpawnPositionFinder spawnPositionFinder,IEntityServices entityServices, ZoneManager zoneManager)
{
_zone = zone;
_spawnTime = spawnTime;
_spawnPositionFinder = spawnPositionFinder;
_entityServices = entityServices;
+ _zonemanager = zoneManager;
r = new Random();
}
@@ -79,9 +82,7 @@ public RiftManager(IZone zone,TimeRange spawnTime,RiftSpawnPositionFinder spawnP
public void Update(TimeSpan time)
{
- // FIXME: this needs to be in the database.
- // do not spawn rifts on zone 16 (the stronghold)
- while (_riftCounts < 10 && _zone.Id != 16)
+ while (_riftCounts < 10 && !(_zone is StrongHoldZone))
{
_nextRiftSpawns.AddLast(new TimeTracker(FastRandom.NextTimeSpan(_spawnTime)));
Interlocked.Increment(ref _riftCounts);
@@ -98,6 +99,23 @@ public void Update(TimeSpan time)
});
}
+ ///
+ /// Get a random active stronghold zone.
+ ///
+ /// int
+ private int GetRandomStrongHoldZone()
+ {
+ IEnumerable strongholdzones = _zonemanager.Zones.OfType();
+ // less than elegant. if we only have one stronghold zone just return it.
+ if (strongholdzones.Count() == 1)
+ {
+ return strongholdzones.ElementAt(0).Id;
+ }
+ int index = r.Next(0, strongholdzones.Count());
+ Zone selzone = strongholdzones.ElementAt(index);
+ return selzone.Id;
+ }
+
private void SpawnRift()
{
var rift = (Rift)_entityServices.Factory.CreateWithRandomEID(DefinitionNames.RIFT);
@@ -106,15 +124,17 @@ private void SpawnRift()
rift.RemovedFromZone += OnRiftRemovedFromZone;
// only generate one stronghold teleport and make it random chance.
- int rand = r.Next(0, 10);
- if (rand == 2 && !StrongHoldRiftGenerated)
- {
- rift.IsDestinationStronghold = true;
- }
+ //int rand = r.Next(0, 10);
+ //if (rand == 2 && !StrongHoldRiftGenerated)
+ //{
+ rift.DestinationStrongholdZone = GetRandomStrongHoldZone();
+ rift.OriginZone = this._zone.Id;
+ //StrongHoldRiftGenerated = true;
+ //}
var spawnPosition = _spawnPositionFinder.FindSpawnPosition().ToPosition();
rift.AddToZone(_zone, spawnPosition, ZoneEnterType.NpcSpawn);
- Logger.Info("Rift spawned. " + rift.ED.Name + " (" + rift.CurrentPosition + ") Stronghold:" + rift.IsDestinationStronghold);
+ Logger.Info(string.Format("Rift spawned on zone {0} {1} ({2}) Stronghold Zone ID: {3}", _zone.Id, rift.ED.Name, rift.CurrentPosition, rift.DestinationStrongholdZone));
}
private void OnRiftRemovedFromZone(Unit unit)
diff --git a/src/Perpetuum/Zones/StrongHoldZone.cs b/src/Perpetuum/Zones/StrongHoldZone.cs
new file mode 100644
index 000000000..4923eb8d6
--- /dev/null
+++ b/src/Perpetuum/Zones/StrongHoldZone.cs
@@ -0,0 +1,17 @@
+using Perpetuum.Groups.Gangs;
+using Perpetuum.Services.Sessions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Perpetuum.Zones
+{
+ public class StrongHoldZone : Zone
+ {
+ public StrongHoldZone(ISessionManager sessionManager, IGangManager gangManager) : base(sessionManager, gangManager)
+ {
+ }
+ }
+}
diff --git a/src/Perpetuum/Zones/ZoneType.cs b/src/Perpetuum/Zones/ZoneType.cs
index 2f732a33a..c477dcbbc 100644
--- a/src/Perpetuum/Zones/ZoneType.cs
+++ b/src/Perpetuum/Zones/ZoneType.cs
@@ -5,6 +5,7 @@ public enum ZoneType
Undefined = 0,
Pve,
Pvp,
- Training
+ Training,
+ Stronghold
}
}
\ No newline at end of file
From 91685961c1383674d19168c8f744e936d5c63252 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sat, 3 Feb 2018 13:06:20 -0500
Subject: [PATCH 027/457] forgot to put back random chance.
---
src/Perpetuum/Services/RiftSystem/RiftManager.cs | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/Perpetuum/Services/RiftSystem/RiftManager.cs b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
index cbe99cf50..2357f0488 100644
--- a/src/Perpetuum/Services/RiftSystem/RiftManager.cs
+++ b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
@@ -123,14 +123,13 @@ private void SpawnRift()
rift.SetDespawnTime(TimeSpan.FromHours(3));
rift.RemovedFromZone += OnRiftRemovedFromZone;
- // only generate one stronghold teleport and make it random chance.
- //int rand = r.Next(0, 10);
- //if (rand == 2 && !StrongHoldRiftGenerated)
- //{
+ // generate a stronghold teleport and make it random chance.
+ int rand = r.Next(0, 10);
+ if (rand == 2 && !StrongHoldRiftGenerated)
+ {
rift.DestinationStrongholdZone = GetRandomStrongHoldZone();
rift.OriginZone = this._zone.Id;
- //StrongHoldRiftGenerated = true;
- //}
+ }
var spawnPosition = _spawnPositionFinder.FindSpawnPosition().ToPosition();
rift.AddToZone(_zone, spawnPosition, ZoneEnterType.NpcSpawn);
From 37a89ae83b91b52d1e1ed1bdbaeb2e76b2fc3e35 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sat, 3 Feb 2018 21:34:50 -0500
Subject: [PATCH 028/457] more command updates.
---
.../Services/Channels/GameAdminCommands.cs | 30 +++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/src/Perpetuum/Services/Channels/GameAdminCommands.cs b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
index 459f93872..b81454641 100644
--- a/src/Perpetuum/Services/Channels/GameAdminCommands.cs
+++ b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
@@ -3,6 +3,7 @@
using Perpetuum.GenXY;
using Perpetuum.Host.Requests;
using Perpetuum.Players;
+using Perpetuum.Services.RiftSystem;
using Perpetuum.Services.Sessions;
using Perpetuum.Zones;
using Perpetuum.Zones.Locking.Locks;
@@ -44,8 +45,7 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
channel.SendMessageToAll(sessionManager, sender, "Channel must be secured before sending commands.");
return;
- }
-
+ }
if (command[0] == "#shutdown")
{
@@ -720,6 +720,32 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
}
+ if (command[0] == "#listrifts")
+ {
+ foreach (IZone z in request.Session.ZoneMgr.Zones)
+ {
+ var rift = z.Units.OfType();
+ foreach (Rift r in rift)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Rift - Zone: {0}, Position: ({1}), Destination Zone:{2}", r.Zone, r.CurrentPosition, r.DestinationStrongholdZone));
+ }
+ }
+ }
+
+
+ if (command[0] == "#flagplayernameoffensive")
+ {
+ bool err = false;
+ err = !int.TryParse(command[1], out int characterID);
+ err = !bool.TryParse(command[2], out bool isoffensive);
+
+ var charactersession = sessionManager.GetByCharacter(characterID);
+ charactersession.Character.IsOffensiveNick = isoffensive;
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Player with nick {0} is offensive:{1}", charactersession.Character.Nick, charactersession.Character.IsOffensiveNick));
+
+ }
+
}
}
}
From 569fde2b9d43a75b149c30c69c501e2c52a3a4af Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Sat, 3 Feb 2018 21:44:47 -0500
Subject: [PATCH 029/457] Tutorial Fix -- force send to TMA (#19)
---
.../Zones/Teleporting/Strategies/TrainingExitStrategy.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs
index 66fad4851..4af8e3f77 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TrainingExitStrategy.cs
@@ -71,7 +71,9 @@ public void DoTeleport(Player player)
var sparkToActivate = _sparkHelper.ConvertCharacterWizardSparkIdToSpark(info.sparkId);
_sparkHelper.ActivateSpark(character, sparkToActivate);
- var dockingBase = newCorporation.GetDockingBase();
+ //Grab TM-UAS docking base for New Virginia
+ var hardCodeTMACorp = DefaultCorporation.GetBySchool(1, 1);
+ var dockingBase = hardCodeTMACorp.GetDockingBase();
dockingBase.CreateStarterRobotForCharacter(character, true);
dockingBase.DockIn(character, TimeSpan.Zero, ZoneExitType.TrainingExitTeleport);
From 5e887056f864418a8b05bffc98f3fb0ddbbb4e76 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sat, 3 Feb 2018 21:45:01 -0500
Subject: [PATCH 030/457] Loyal dev (#20)
* improvements to commands / teleporting.
* improvements to the command interface
* we have to teleport someplace!
* rift system + stronghold overhaul.
* forgot to put back random chance.
* more command updates.
---
.../PerpetuumBootstrapper.cs | 2 +
.../Zone/StatsMapDrawing/ZoneDrawStatMap.cs | 6 +-
src/Perpetuum/Modules/Weapons/WeaponModule.cs | 6 +
src/Perpetuum/Perpetuum.csproj | 1 +
src/Perpetuum/Players/Player.cs | 1 +
src/Perpetuum/Services/Channels/Channel.cs | 25 +-
.../Services/Channels/ChannelManager.cs | 8 +-
.../Services/Channels/ChannelRepository.cs | 5 +-
.../Services/Channels/GameAdminCommands.cs | 280 +++++++++++++++++-
src/Perpetuum/Services/RiftSystem/Rift.cs | 29 +-
.../Services/RiftSystem/RiftManager.cs | 33 ++-
.../Services/Sessions/ISessionManager.cs | 1 +
.../Services/Sessions/SessionManager.cs | 11 +
src/Perpetuum/Units/Unit.Visibility.cs | 8 +-
src/Perpetuum/Zones/StrongHoldZone.cs | 17 ++
.../Strategies/TeleportToAnotherZone.cs | 9 +-
src/Perpetuum/Zones/ZoneType.cs | 3 +-
17 files changed, 404 insertions(+), 41 deletions(-)
create mode 100644 src/Perpetuum/Zones/StrongHoldZone.cs
diff --git a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
index 8648aaf25..1e3e77e81 100644
--- a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
+++ b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
@@ -2354,6 +2354,8 @@ void RegisterZone(ZoneType type) where T:Zone
RegisterZone(ZoneType.Pve);
RegisterZone(ZoneType.Pvp);
RegisterZone(ZoneType.Training);
+ RegisterZone(ZoneType.Stronghold);
+
_builder.RegisterType();
_builder.RegisterType();
diff --git a/src/Perpetuum.RequestHandlers/Zone/StatsMapDrawing/ZoneDrawStatMap.cs b/src/Perpetuum.RequestHandlers/Zone/StatsMapDrawing/ZoneDrawStatMap.cs
index 6f8ffe41d..791b1f2d6 100644
--- a/src/Perpetuum.RequestHandlers/Zone/StatsMapDrawing/ZoneDrawStatMap.cs
+++ b/src/Perpetuum.RequestHandlers/Zone/StatsMapDrawing/ZoneDrawStatMap.cs
@@ -25,16 +25,15 @@ namespace Perpetuum.RequestHandlers.Zone.StatsMapDrawing
{
public partial class ZoneDrawStatMap : IRequestHandler
{
- private readonly IZone _zone;
+ private IZone _zone;
private readonly IFileSystem _fileSystem;
private readonly SaveBitmapHelper _saveBitmapHelper;
private readonly MissionDataCache _missionDataCache;
private readonly Dictionary> _actions = new Dictionary>();
private string _typeString;
- public ZoneDrawStatMap(IZone zone,IFileSystem fileSystem,SaveBitmapHelper saveBitmapHelper,MissionDataCache missionDataCache)
+ public ZoneDrawStatMap(IFileSystem fileSystem,SaveBitmapHelper saveBitmapHelper,MissionDataCache missionDataCache)
{
- _zone = zone;
_fileSystem = fileSystem;
_saveBitmapHelper = saveBitmapHelper;
_missionDataCache = missionDataCache;
@@ -86,6 +85,7 @@ private void CreateAndSave(string postfix,Func bitmapFactory)
public void HandleRequest(IZoneRequest request)
{
+ _zone = request.Zone;
var type = request.Data.GetOrDefault(k.type);
_typeString = type; //save for later use
diff --git a/src/Perpetuum/Modules/Weapons/WeaponModule.cs b/src/Perpetuum/Modules/Weapons/WeaponModule.cs
index 2c4d80c14..6b969fdac 100644
--- a/src/Perpetuum/Modules/Weapons/WeaponModule.cs
+++ b/src/Perpetuum/Modules/Weapons/WeaponModule.cs
@@ -4,6 +4,7 @@
using System.Threading.Tasks;
using Perpetuum.EntityFramework;
using Perpetuum.ExportedTypes;
+using Perpetuum.Services.RiftSystem;
using Perpetuum.Units;
using Perpetuum.Zones;
using Perpetuum.Zones.Beams;
@@ -77,6 +78,11 @@ public void VisitUnitLock(UnitLock unitLock)
victim.IsInvulnerable.ThrowIfTrue(ErrorCodes.TargetIsInvulnerable);
+ if (victim is Rift && (_weapon.ParentRobot.Zone is StrongHoldZone))
+ {
+ throw new PerpetuumException(ErrorCodes.TargetIsNonAttackable);
+ }
+
_weapon.ConsumeAmmo();
var result = _weapon.GetLineOfSight(victim);
diff --git a/src/Perpetuum/Perpetuum.csproj b/src/Perpetuum/Perpetuum.csproj
index 957942098..1aa75cab3 100644
--- a/src/Perpetuum/Perpetuum.csproj
+++ b/src/Perpetuum/Perpetuum.csproj
@@ -842,6 +842,7 @@
+
diff --git a/src/Perpetuum/Players/Player.cs b/src/Perpetuum/Players/Player.cs
index 68472e8e5..203bcd4a8 100644
--- a/src/Perpetuum/Players/Player.cs
+++ b/src/Perpetuum/Players/Player.cs
@@ -156,6 +156,7 @@ public Player(IExtensionReader extensionReader,ICorporationManager corporationMa
public long CorporationEid { get; set; }
public IZoneSession Session { get; private set; }
public Character Character { get; set; } = Character.None;
+ public bool HasGMStealth { get; set; }
public void SetSession(IZoneSession session)
{
diff --git a/src/Perpetuum/Services/Channels/Channel.cs b/src/Perpetuum/Services/Channels/Channel.cs
index 9384e08f6..cca52d9ac 100644
--- a/src/Perpetuum/Services/Channels/Channel.cs
+++ b/src/Perpetuum/Services/Channels/Channel.cs
@@ -6,7 +6,7 @@ namespace Perpetuum.Services.Channels
{
public class Channel
{
- private Dictionary _members = new Dictionary();
+ private Dictionary _members = new Dictionary();
public int Id { get; private set; }
public ChannelType Type { get; private set; }
@@ -19,17 +19,17 @@ public class Channel
private Channel()
{
-
+
}
- public Channel(int id,ChannelType type,string name,string topic,string password,IChannelLogger logger) : this(type,name,logger)
+ public Channel(int id, ChannelType type, string name, string topic, string password, IChannelLogger logger) : this(type, name, logger)
{
Id = id;
Topic = topic;
Password = password;
}
- public Channel(ChannelType type, string name,IChannelLogger logger)
+ public Channel(ChannelType type, string name, IChannelLogger logger)
{
Type = type;
Name = name;
@@ -61,7 +61,7 @@ public Channel SetId(int id)
public Channel SetTopic(string topic)
{
- if ( !string.IsNullOrEmpty(topic) && topic.Length > 200)
+ if (!string.IsNullOrEmpty(topic) && topic.Length > 200)
topic = topic.Substring(0, 199);
if (topic == Topic)
@@ -101,7 +101,7 @@ public Channel SetMember(ChannelMember member)
if (member == null)
return this;
- var members = new Dictionary(_members) {[member.character] = member};
+ var members = new Dictionary(_members) { [member.character] = member };
return new Channel
{
@@ -115,6 +115,19 @@ public Channel SetMember(ChannelMember member)
};
}
+ public void SetAdmin(bool isadminchannel)
+ {
+ if (isadminchannel)
+ {
+ this.Type = ChannelType.Admin;
+ }
+ else
+ {
+ this.Type = ChannelType.Public;
+ }
+ }
+
+
public Channel RemoveMember(Character member)
{
var members = new Dictionary(_members);
diff --git a/src/Perpetuum/Services/Channels/ChannelManager.cs b/src/Perpetuum/Services/Channels/ChannelManager.cs
index 45c6cc3b7..69902afdf 100644
--- a/src/Perpetuum/Services/Channels/ChannelManager.cs
+++ b/src/Perpetuum/Services/Channels/ChannelManager.cs
@@ -264,12 +264,12 @@ public void Talk(string channelName, Character sender, string message, IRequest
m.CanTalk.ThrowIfFalse(ErrorCodes.CharacterIsMuted);
channel.SendMessageToAll(_sessionManager, sender, message);
- // this is an admin or GM command sent on an admin channel.
- if (message.Substring(0,1) == "#" && channel.Type == ChannelType.Admin)
+ // this is an admin or GM command.
+ if (message.Substring(0, 1) == "#" && sender.AccessLevel == AccessLevel.toolAdmin)
{
- channel.AdminCommands.ParseAdminCommand(sender, message, request, channel, _sessionManager);
+ channel.AdminCommands.ParseAdminCommand(sender, message, request, channel, _sessionManager, this);
}
-
+
}
public void KickOrBan(string channelName, Character issuer, Character character, string message, bool ban)
diff --git a/src/Perpetuum/Services/Channels/ChannelRepository.cs b/src/Perpetuum/Services/Channels/ChannelRepository.cs
index 1d69b16d9..afcc54344 100644
--- a/src/Perpetuum/Services/Channels/ChannelRepository.cs
+++ b/src/Perpetuum/Services/Channels/ChannelRepository.cs
@@ -34,10 +34,11 @@ public void Delete(Channel channel)
public void Update(Channel channel)
{
- Db.Query().CommandText("update channels set topic = @topic,password = @password where id = @channelid")
+ Db.Query().CommandText("update channels set topic = @topic, password = @password, type=@type where id = @channelid")
.SetParameter("@topic", channel.Topic)
.SetParameter("@password", channel.Password)
- .SetParameter("@channelid",channel.Id)
+ .SetParameter("@type", channel.Type)
+ .SetParameter("@channelid",channel.Id)
.ExecuteNonQuery().ThrowIfEqual(0, ErrorCodes.SQLUpdateError);
}
diff --git a/src/Perpetuum/Services/Channels/GameAdminCommands.cs b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
index cf3f5e054..b81454641 100644
--- a/src/Perpetuum/Services/Channels/GameAdminCommands.cs
+++ b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
@@ -1,9 +1,15 @@
using Perpetuum.Accounting.Characters;
+using Perpetuum.ExportedTypes;
using Perpetuum.GenXY;
using Perpetuum.Host.Requests;
+using Perpetuum.Players;
+using Perpetuum.Services.RiftSystem;
using Perpetuum.Services.Sessions;
+using Perpetuum.Zones;
using Perpetuum.Zones.Locking.Locks;
+using Perpetuum.Zones.Teleporting.Strategies;
using Perpetuum.Zones.Terrains;
+using Perpetuum.Zones.Terrains.Materials.Plants;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -22,10 +28,25 @@ public GameAdminCommands()
// obviously everything coming in from the in-game chat is a string.
// we have to take that string and chop it up, work out what command is being executed
// then parse/cast/convert arguments as necessary.
- public void ParseAdminCommand(Character sender, string text, IRequest request, Channel channel, ISessionManager sessionManager)
+ public void ParseAdminCommand(Character sender, string text, IRequest request, Channel channel, ISessionManager sessionManager, ChannelManager channelmanager)
{
string[] command = text.Split(new char[] { ',' });
+ // channel is not secured. must be secured first.
+ if (channel.Type != ChannelType.Admin)
+ {
+
+ if (command[0] == "#secure")
+ {
+ channel.SetAdmin(true);
+ channel.SendMessageToAll(sessionManager, sender, "Channel Secured.");
+ return;
+ }
+
+ channel.SendMessageToAll(sessionManager, sender, "Channel must be secured before sending commands.");
+ return;
+ }
+
if (command[0] == "#shutdown")
{
DateTime shutdownin = DateTime.Now;
@@ -78,24 +99,49 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
{
bool err = false;
err = !int.TryParse(command[1], out int characterID);
- err = !int.TryParse(command[2], out int x);
- err = !int.TryParse(command[3], out int y);
+ err = !int.TryParse(command[2], out int zoneID);
+ err = !int.TryParse(command[3], out int x);
+ err = !int.TryParse(command[4], out int y);
if (err)
{
throw PerpetuumException.Create(ErrorCodes.RequiredArgumentIsNotSpecified);
}
+
+ // get the target character's session.
+ var charactersession = sessionManager.GetByCharacter(characterID);
- Dictionary dictionary = new Dictionary()
+ if (charactersession.Character.ZoneId == null)
{
- { "characterID" , characterID },
- { "x" , x },
- { "y" , y }
- };
+ channel.SendMessageToAll(sessionManager, sender, string.Format("ERR: Character with ID {0} does not have a zone. Are they docked?", characterID));
+ return;
+ }
+
+ // get destination zone.
+ var zone = request.Session.ZoneMgr.GetZone(zoneID);
- string cmd = string.Format("zoneMoveUnit:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
- request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
- }
+ if (charactersession.Character.ZoneId == null)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("ERR: Invalid Zone ID {0}", zoneID));
+ return;
+ }
+
+ // get a teleporter object to teleport the player.
+ TeleportToAnotherZone tp = new TeleportToAnotherZone(zone);
+
+ // we need the player (robot, etc) to teleport on the origin zone
+ var player = request.Session.ZoneMgr.GetZone((int)charactersession.Character.ZoneId).GetPlayer(charactersession.Character.ActiveRobotEid);
+ //var player = zone.GetPlayer(charactersession.Character.Eid);
+ // set the position.
+ tp.TargetPosition = new Position(x, y);
+
+ // do it.
+ tp.DoTeleportAsync(player);
+ tp = null;
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Moved Character {0}-{1} to Zone {2} @ {3},{4}", characterID, charactersession.Character.Nick, zone.Id, x, y));
+ }
+#if DEBUG
if (command[0] == "#currentzonecleanobstacleblocking")
{
string cmd = string.Format("zoneCleanObstacleBlocking:zone_{0}:null", sender.ZoneId);
@@ -488,6 +534,218 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
channel.SendMessageToAll(sessionManager, sender, string.Format("Altered state of control layer on {0} Tiles (Roaming)", lockedtiles.Count));
}
+ if (command[0] == "#zonetilesPBSTerraformProtected")
+ {
+
+ bool.TryParse(command[1], out bool adddelete);
+ bool.TryParse(command[2], out bool keeplock);
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var lockedtiles = player.GetLocks();
+
+ using (new TerrainUpdateMonitor(zone))
+ {
+ foreach (Lock item in lockedtiles)
+ {
+ Position pos = (item as TerrainLock).Location;
+ TerrainControlInfo ti = zone.Terrain.Controls.GetValue(pos);
+ ti.PBSTerraformProtected = adddelete;
+ zone.Terrain.Controls.SetValue(pos, ti);
+ if (!keeplock)
+ {
+ item.Cancel(); // cancel this lock. we processed it.
+ }
+ }
+ }
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Altered state of control layer on {0} Tiles (PBSTerraformProtected)", lockedtiles.Count));
+ }
+
+#endif
+
+ if (command[0] == "#giveitem")
+ {
+
+ int.TryParse(command[1], out int definition);
+ int.TryParse(command[2], out int qty);
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "definition", definition },
+ { "quantity", qty }
+ };
+
+
+ string cmd = string.Format("createItem:relay:{0}", GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Gave Item {0} ", definition));
+ }
+
+
+ if (command[0] == "#getlockedtileproperties")
+ {
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ var lockedtile = player.GetPrimaryLock();
+
+ TerrainControlInfo ti = zone.Terrain.Controls.GetValue((lockedtile as TerrainLock).Location);
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Tile at {0},{1} has the following flags..", (lockedtile as TerrainLock).Location.X, (lockedtile as TerrainLock).Location.Y));
+ channel.SendMessageToAll(sessionManager, sender, "TerrainControlFlags:");
+ foreach (TerrainControlFlags f in Enum.GetValues(typeof(TerrainControlFlags)))
+ {
+ if (ti.Flags.HasFlag(f) && f != TerrainControlFlags.Undefined)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("{0}", f.ToString()));
+ }
+ }
+
+ BlockingInfo bi = zone.Terrain.Blocks.GetValue((lockedtile as TerrainLock).Location);
+
+ channel.SendMessageToAll(sessionManager, sender, "BlockingFlags:");
+ foreach (BlockingFlags f in Enum.GetValues(typeof(BlockingFlags)))
+ {
+ if (bi.Flags.HasFlag(f) && f != BlockingFlags.Undefined)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("{0}", f.ToString()));
+ }
+ }
+
+ PlantInfo pi = zone.Terrain.Plants.GetValue((lockedtile as TerrainLock).Location);
+
+ channel.SendMessageToAll(sessionManager, sender, "PlantType:");
+ foreach (PlantType f in Enum.GetValues(typeof(PlantType)))
+ {
+ if (pi.type.HasFlag(f) && f != PlantType.NotDefined)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("{0}", f.ToString()));
+ }
+ }
+
+ channel.SendMessageToAll(sessionManager, sender, "GroundType:");
+ foreach (GroundType f in Enum.GetValues(typeof(GroundType)))
+ {
+ if (pi.groundType.HasFlag(f))
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("{0}", f.ToString()));
+ }
+ }
+
+ }
+
+ if (command[0] == "#setvisibility")
+ {
+
+ bool.TryParse(command[1], out bool visiblestate);
+
+ var character = request.Session.Character;
+ var zone = request.Session.ZoneMgr.GetZone((int)character.ZoneId);
+ var player = zone.GetPlayer(character.ActiveRobotEid);
+
+ player.HasGMStealth = !visiblestate;
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Player {0} visibility is {1}", player.Character.Nick, visiblestate));
+ }
+
+ if (command[0] == "#zonedrawstatmap")
+ {
+
+ Dictionary dictionary = new Dictionary()
+ {
+ { "type", command[1] }
+ };
+
+ string cmd = string.Format("zoneDrawStatMap:zone_{0}:{1}", sender.ZoneId, GenxyConverter.Serialize(dictionary));
+ request.Session.HandleLocalRequest(request.Session.CreateLocalRequest(cmd));
+ }
+
+
+ if (command[0] == "#listplayersinzone")
+ {
+
+ int.TryParse(command[1], out int zoneid);
+
+ var zone = request.Session.ZoneMgr.GetZone((int)zoneid);
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Players On Zone {0}", zone.Id));
+ channel.SendMessageToAll(sessionManager, sender, string.Format(" AccountId CharacterId Nick Access Level Docked? DockedAt Position"));
+ foreach (Character c in sessionManager.SelectedCharacters)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format(" {0} {1} {2} {3} {4} {5} {6}",
+ c.AccountId, c.Id, c.Nick, c.AccessLevel, c.IsDocked, c.GetCurrentDockingBase().Eid, c.ZonePosition));
+ }
+ }
+
+ if (command[0] == "#countofplayers")
+ {
+ foreach (IZone z in request.Session.ZoneMgr.Zones)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Players On Zone {0}: {1}", z.Id, z.Players.ToList().Count));
+ }
+ }
+
+ if (command[0] == "#unsecure")
+ {
+ channel.SetAdmin(false);
+ channel.SendMessageToAll(sessionManager, sender, "Channel is now public.");
+ }
+
+ if (command[0] == "#addtochannel")
+ {
+ int.TryParse(command[1], out int characterid);
+
+ var c = sessionManager.GetByCharacter(characterid);
+
+ channelmanager.JoinChannel(channel.Name, c.Character, ChannelMemberRole.Operator, string.Empty);
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Added character {0} to channel ", c.Character.Nick));
+
+ }
+
+ if (command[0] == "#removefromchannel")
+ {
+ int.TryParse(command[1], out int characterid);
+
+ var c = sessionManager.GetByCharacter(characterid);
+
+ channelmanager.LeaveChannel(channel.Name, c.Character);
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Removed character {0} from channel ", c.Character.Nick));
+
+ }
+
+ if (command[0] == "#listrifts")
+ {
+ foreach (IZone z in request.Session.ZoneMgr.Zones)
+ {
+ var rift = z.Units.OfType();
+ foreach (Rift r in rift)
+ {
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Rift - Zone: {0}, Position: ({1}), Destination Zone:{2}", r.Zone, r.CurrentPosition, r.DestinationStrongholdZone));
+ }
+ }
+ }
+
+
+ if (command[0] == "#flagplayernameoffensive")
+ {
+ bool err = false;
+ err = !int.TryParse(command[1], out int characterID);
+ err = !bool.TryParse(command[2], out bool isoffensive);
+
+ var charactersession = sessionManager.GetByCharacter(characterID);
+ charactersession.Character.IsOffensiveNick = isoffensive;
+
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Player with nick {0} is offensive:{1}", charactersession.Character.Nick, charactersession.Character.IsOffensiveNick));
+
+ }
+
}
}
}
diff --git a/src/Perpetuum/Services/RiftSystem/Rift.cs b/src/Perpetuum/Services/RiftSystem/Rift.cs
index e0c710fae..f4579ed18 100644
--- a/src/Perpetuum/Services/RiftSystem/Rift.cs
+++ b/src/Perpetuum/Services/RiftSystem/Rift.cs
@@ -12,6 +12,7 @@
using Perpetuum.Zones;
using Perpetuum.Zones.Blobs.BlobEmitters;
using Perpetuum.Zones.NpcSystem.Presences;
+using Perpetuum.Zones.Teleporting;
using Perpetuum.Zones.Teleporting.Strategies;
namespace Perpetuum.Services.RiftSystem
@@ -131,7 +132,8 @@ public Rift(ITeleportStrategyFactories teleportStrategyFactories)
_blobEmitter = new BlobEmitter(this);
}
- public bool IsDestinationStronghold { get; set; } = false;
+ public int DestinationStrongholdZone { get; set; }
+ public int OriginZone { get; set; }
public void SetDespawnTime(TimeSpan despawnTime)
{
@@ -178,13 +180,30 @@ public void UseItem(Player player)
player.HasTeleportSicknessEffect.ThrowIfTrue(ErrorCodes.TeleportTimerStillRunning);
player.HasPvpEffect.ThrowIfTrue(ErrorCodes.CantBeUsedInPvp);
- IZone destination = player.Character.GetZone(16);
+
+ // we are on a stronghold. we want to go home.
+ // for the moment we will send them to a teleporter on zone 0.
+ if (player.Zone is StrongHoldZone)
+ {
+ var destZone = player.Character.GetZone(0);
+ var teleportColumns = destZone.GetTeleportColumns().Where(t => t.IsEnabled);
+ var teleport = _teleportStrategyFactories.TeleportToAnotherZoneFactory(destZone);
+ teleport.TargetPosition = teleportColumns.First().CurrentPosition;
+ teleport.DoTeleportAsync(player);
+ return;
+ }
// teleport player to stronghold
// stronghold zone must be active.
- if (this.IsDestinationStronghold && destination != null)
+ if (this.DestinationStrongholdZone > 0)
{
- var teleport = _teleportStrategyFactories.TeleportToAnotherZoneFactory(destination);
+ var destZone = player.Character.GetZone(DestinationStrongholdZone);
+ var teleport = _teleportStrategyFactories.TeleportToAnotherZoneFactory(destZone);
+ // there should only be one, for now.
+ // FIXME: some zones may have more than one stronghold.
+ // we will need to link anomalies like teleporters.
+ var pos = destZone.Units.OfType().First();
+ teleport.TargetPosition = pos.CurrentPosition;
teleport.DoTeleportAsync(player);
}
else
@@ -193,7 +212,9 @@ public void UseItem(Player player)
var nearestRift = Zone.Units.OfType().Where(rift => rift != this).GetNearestUnit(CurrentPosition);
if (nearestRift == null)
+ {
throw new PerpetuumException(ErrorCodes.WTFErrorMedicalAttentionSuggested);
+ }
var teleport = _teleportStrategyFactories.TeleportWithinZoneFactory();
teleport.TargetPosition = nearestRift.CurrentPosition;
diff --git a/src/Perpetuum/Services/RiftSystem/RiftManager.cs b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
index 489f3ef73..2357f0488 100644
--- a/src/Perpetuum/Services/RiftSystem/RiftManager.cs
+++ b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
+using System.Linq;
using System.Threading;
using Perpetuum.EntityFramework;
using Perpetuum.ExportedTypes;
@@ -61,17 +62,19 @@ public class RiftManager
private readonly TimeRange _spawnTime;
private readonly RiftSpawnPositionFinder _spawnPositionFinder;
private readonly IEntityServices _entityServices;
+ private readonly ZoneManager _zonemanager;
private bool StrongHoldRiftGenerated { get; set; } = false;
private Random r;
private readonly LinkedList _nextRiftSpawns = new LinkedList();
- public RiftManager(IZone zone,TimeRange spawnTime,RiftSpawnPositionFinder spawnPositionFinder,IEntityServices entityServices)
+ public RiftManager(IZone zone,TimeRange spawnTime,RiftSpawnPositionFinder spawnPositionFinder,IEntityServices entityServices, ZoneManager zoneManager)
{
_zone = zone;
_spawnTime = spawnTime;
_spawnPositionFinder = spawnPositionFinder;
_entityServices = entityServices;
+ _zonemanager = zoneManager;
r = new Random();
}
@@ -79,9 +82,7 @@ public RiftManager(IZone zone,TimeRange spawnTime,RiftSpawnPositionFinder spawnP
public void Update(TimeSpan time)
{
- // FIXME: this needs to be in the database.
- // do not spawn rifts on zone 16 (the stronghold)
- while (_riftCounts < 10 && _zone.Id != 16)
+ while (_riftCounts < 10 && !(_zone is StrongHoldZone))
{
_nextRiftSpawns.AddLast(new TimeTracker(FastRandom.NextTimeSpan(_spawnTime)));
Interlocked.Increment(ref _riftCounts);
@@ -98,6 +99,23 @@ public void Update(TimeSpan time)
});
}
+ ///
+ /// Get a random active stronghold zone.
+ ///
+ /// int
+ private int GetRandomStrongHoldZone()
+ {
+ IEnumerable strongholdzones = _zonemanager.Zones.OfType();
+ // less than elegant. if we only have one stronghold zone just return it.
+ if (strongholdzones.Count() == 1)
+ {
+ return strongholdzones.ElementAt(0).Id;
+ }
+ int index = r.Next(0, strongholdzones.Count());
+ Zone selzone = strongholdzones.ElementAt(index);
+ return selzone.Id;
+ }
+
private void SpawnRift()
{
var rift = (Rift)_entityServices.Factory.CreateWithRandomEID(DefinitionNames.RIFT);
@@ -105,16 +123,17 @@ private void SpawnRift()
rift.SetDespawnTime(TimeSpan.FromHours(3));
rift.RemovedFromZone += OnRiftRemovedFromZone;
- // only generate one stronghold teleport and make it random chance.
+ // generate a stronghold teleport and make it random chance.
int rand = r.Next(0, 10);
if (rand == 2 && !StrongHoldRiftGenerated)
{
- rift.IsDestinationStronghold = true;
+ rift.DestinationStrongholdZone = GetRandomStrongHoldZone();
+ rift.OriginZone = this._zone.Id;
}
var spawnPosition = _spawnPositionFinder.FindSpawnPosition().ToPosition();
rift.AddToZone(_zone, spawnPosition, ZoneEnterType.NpcSpawn);
- Logger.Info("Rift spawned. " + rift.ED.Name + " (" + rift.CurrentPosition + ") Stronghold:" + rift.IsDestinationStronghold);
+ Logger.Info(string.Format("Rift spawned on zone {0} {1} ({2}) Stronghold Zone ID: {3}", _zone.Id, rift.ED.Name, rift.CurrentPosition, rift.DestinationStrongholdZone));
}
private void OnRiftRemovedFromZone(Unit unit)
diff --git a/src/Perpetuum/Services/Sessions/ISessionManager.cs b/src/Perpetuum/Services/Sessions/ISessionManager.cs
index e80237497..7767cec46 100644
--- a/src/Perpetuum/Services/Sessions/ISessionManager.cs
+++ b/src/Perpetuum/Services/Sessions/ISessionManager.cs
@@ -10,6 +10,7 @@ public interface ISessionManager
ISession GetByCharacter(Character character);
ISession GetByAccount(Account account);
ISession GetByAccount(int accountId);
+ ISession GetByCharacter(int characterid);
IEnumerable Sessions { get;}
IEnumerable SelectedCharacters { get; }
bool Contains(SessionID sessionId);
diff --git a/src/Perpetuum/Services/Sessions/SessionManager.cs b/src/Perpetuum/Services/Sessions/SessionManager.cs
index 17569a73d..6a73d9d4e 100644
--- a/src/Perpetuum/Services/Sessions/SessionManager.cs
+++ b/src/Perpetuum/Services/Sessions/SessionManager.cs
@@ -169,6 +169,17 @@ public ISession GetByAccount(int accountId)
return _sessions.Values.FirstOrDefault(s => s.AccountId == accountId);
}
+ [CanBeNull]
+ public ISession GetByCharacter(int characterid)
+ {
+ if (characterid == 0)
+ {
+ return null;
+ }
+ return _sessions.Values.FirstOrDefault(s => s.Character.Id == characterid);
+ }
+
+
public bool IsOnline(Character character)
{
return _charactersIndex.ContainsKey(character);
diff --git a/src/Perpetuum/Units/Unit.Visibility.cs b/src/Perpetuum/Units/Unit.Visibility.cs
index 00475b041..acec40221 100644
--- a/src/Perpetuum/Units/Unit.Visibility.cs
+++ b/src/Perpetuum/Units/Unit.Visibility.cs
@@ -57,8 +57,14 @@ protected void UpdateVisibility(Unit target)
if (InZone && target.InZone)
{
- if ( IsDetected(target) )
+ if (target.IsPlayer() && (target as Player).HasGMStealth)
+ {
+ visibility = Visibility.Invisible;
+ }
+ else if (IsDetected(target))
+ {
visibility = Visibility.Visible;
+ }
}
UnitVisibility info;
diff --git a/src/Perpetuum/Zones/StrongHoldZone.cs b/src/Perpetuum/Zones/StrongHoldZone.cs
new file mode 100644
index 000000000..4923eb8d6
--- /dev/null
+++ b/src/Perpetuum/Zones/StrongHoldZone.cs
@@ -0,0 +1,17 @@
+using Perpetuum.Groups.Gangs;
+using Perpetuum.Services.Sessions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Perpetuum.Zones
+{
+ public class StrongHoldZone : Zone
+ {
+ public StrongHoldZone(ISessionManager sessionManager, IGangManager gangManager) : base(sessionManager, gangManager)
+ {
+ }
+ }
+}
diff --git a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
index 70481ad1b..d17df43d9 100644
--- a/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
+++ b/src/Perpetuum/Zones/Teleporting/Strategies/TeleportToAnotherZone.cs
@@ -42,8 +42,13 @@ public void DoTeleport(Player player)
[CanBeNull]
public Task DoTeleportAsync(Player player)
{
- // FIXME: this needs to calculate a proper position but the server does not have the altitude data for this map
- var validPosition = new Position(1120, 1039);
+ // get a valid position to teleport to.
+ var position = new ClosestWalkablePositionFinder(_targetZone, TargetPosition);
+ if (!position.Find(out Position validPosition))
+ {
+ return null;
+ }
+
player.States.Teleport = true;
Entity.Repository.ForceUpdate(player);
var character = player.Character;
diff --git a/src/Perpetuum/Zones/ZoneType.cs b/src/Perpetuum/Zones/ZoneType.cs
index 2f732a33a..c477dcbbc 100644
--- a/src/Perpetuum/Zones/ZoneType.cs
+++ b/src/Perpetuum/Zones/ZoneType.cs
@@ -5,6 +5,7 @@ public enum ZoneType
Undefined = 0,
Pve,
Pvp,
- Training
+ Training,
+ Stronghold
}
}
\ No newline at end of file
From 816acf836262a51a3caa5f14d9495054fcf7b3ab Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Mon, 5 Feb 2018 12:32:07 -0500
Subject: [PATCH 031/457] return players in zone properly.
---
.../Services/Channels/GameAdminCommands.cs | 26 +++++++++----------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/src/Perpetuum/Services/Channels/GameAdminCommands.cs b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
index b81454641..34c81ca7d 100644
--- a/src/Perpetuum/Services/Channels/GameAdminCommands.cs
+++ b/src/Perpetuum/Services/Channels/GameAdminCommands.cs
@@ -229,9 +229,9 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
Dictionary dictionary = new Dictionary()
{
{ "definition", definition },
- { "x", x*255 },
- { "y", y*255 },
- { "z", z },
+ { "x", x*256 },
+ { "y", y*256 },
+ { "z", z*256 },
{ "quaternionX", qx },
{ "quaternionY", qy },
{ "quaternionZ", qz },
@@ -257,9 +257,9 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
return;
}
- int x = terrainLock.Location.intX;
- int y = terrainLock.Location.intY;
- int z = terrainLock.Location.intZ;
+ double x = terrainLock.Location.X;
+ double y = terrainLock.Location.Y;
+ double z = terrainLock.Location.Z;
bool err = !double.TryParse(command[2], out double scale);
err = !int.TryParse(command[1], out int definition);
@@ -272,9 +272,9 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
Dictionary dictionary = new Dictionary()
{
{ "definition", definition },
- { "x", x*255 },
- { "y", y*255 },
- { "z", z*255 },
+ { "x", (int)x*256 },
+ { "y", (int)y*256 },
+ { "z", (int)z*256 },
{ "quaternionX", (double)0 },
{ "quaternionY", (double)0 },
{ "quaternionZ", (double)0 },
@@ -671,14 +671,12 @@ public void ParseAdminCommand(Character sender, string text, IRequest request, C
int.TryParse(command[1], out int zoneid);
- var zone = request.Session.ZoneMgr.GetZone((int)zoneid);
-
- channel.SendMessageToAll(sessionManager, sender, string.Format("Players On Zone {0}", zone.Id));
+ channel.SendMessageToAll(sessionManager, sender, string.Format("Players On Zone {0}", zoneid));
channel.SendMessageToAll(sessionManager, sender, string.Format(" AccountId CharacterId Nick Access Level Docked? DockedAt Position"));
- foreach (Character c in sessionManager.SelectedCharacters)
+ foreach (Character c in sessionManager.SelectedCharacters.Where(x => x.ZoneId == zoneid))
{
channel.SendMessageToAll(sessionManager, sender, string.Format(" {0} {1} {2} {3} {4} {5} {6}",
- c.AccountId, c.Id, c.Nick, c.AccessLevel, c.IsDocked, c.GetCurrentDockingBase().Eid, c.ZonePosition));
+ c.AccountId, c.Id, c.Nick, c.AccessLevel, c.IsDocked, c.GetCurrentDockingBase().Eid, c.GetPlayerRobotFromZone().CurrentPosition));
}
}
From 45758c637489f0623c033d1fc6a2d192c2b146ec Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Mon, 5 Feb 2018 20:28:00 -0500
Subject: [PATCH 032/457] make sure we have stronghold zones enabled.
---
src/Perpetuum/Services/RiftSystem/RiftManager.cs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/Perpetuum/Services/RiftSystem/RiftManager.cs b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
index 2357f0488..c5e95b34e 100644
--- a/src/Perpetuum/Services/RiftSystem/RiftManager.cs
+++ b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
@@ -124,11 +124,15 @@ private void SpawnRift()
rift.RemovedFromZone += OnRiftRemovedFromZone;
// generate a stronghold teleport and make it random chance.
- int rand = r.Next(0, 10);
- if (rand == 2 && !StrongHoldRiftGenerated)
+ // make sure we have at least one stronghold enabled.
+ if (_zonemanager.Zones.OfType().Count() > 0)
{
- rift.DestinationStrongholdZone = GetRandomStrongHoldZone();
- rift.OriginZone = this._zone.Id;
+ int rand = r.Next(0, 10);
+ if (rand == 2 && !StrongHoldRiftGenerated)
+ {
+ rift.DestinationStrongholdZone = GetRandomStrongHoldZone();
+ rift.OriginZone = this._zone.Id;
+ }
}
var spawnPosition = _spawnPositionFinder.FindSpawnPosition().ToPosition();
From 50a3301eaa2fd11bac5cf912ddd9d0dc84c0ca61 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Tue, 6 Feb 2018 00:16:36 -0500
Subject: [PATCH 033/457] properly query and cache insurance records.
---
.../Services/Insurance/InsuranceHelper.cs | 30 ++++++++-----------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git a/src/Perpetuum/Services/Insurance/InsuranceHelper.cs b/src/Perpetuum/Services/Insurance/InsuranceHelper.cs
index 959ec9f8e..be4ccf010 100644
--- a/src/Perpetuum/Services/Insurance/InsuranceHelper.cs
+++ b/src/Perpetuum/Services/Insurance/InsuranceHelper.cs
@@ -410,20 +410,15 @@ public static ErrorCodes GetInsurancePrice(int definition, ref double insuranceF
insurancePayOut = 0;
InsurancePrice insurancePrice;
- if (_insurancePrices.TryGetValue(definition, out insurancePrice))
- {
-
- if (insurancePrice == null)
- {
- return ErrorCodes.WTFErrorMedicalAttentionSuggested;
- }
+ // get insurance price from cache.
+ _insurancePrices.TryGetValue(definition, out insurancePrice);
- }
- else
+ // not in cache.
+ // get record from the database and store in our cache.
+ if (insurancePrice == null)
{
- var record = Db.Query().CommandText("select fee,payout from insuranceprices where definition=@definition").SetParameter("@definition", definition)
- .ExecuteSingleRow();
+ var record = Db.Query().CommandText("select fee,payout from insuranceprices where definition=@definition").SetParameter("@definition", definition).ExecuteSingleRow();
if (record == null)
{
@@ -433,14 +428,13 @@ public static ErrorCodes GetInsurancePrice(int definition, ref double insuranceF
}
insurancePrice = new InsurancePrice
- {
- definition = definition,
- fee = record.GetValue(0),
- payOut = record.GetValue(1)
- };
-
+ {
+ definition = definition,
+ fee = record.GetValue(0),
+ payOut = record.GetValue(1)
+ };
- _insurancePrices.AddOrUpdate(definition, insurancePrice, (k, v) => v);
+ _insurancePrices.AddOrUpdate(definition, insurancePrice, (k, v) => insurancePrice);
}
insuranceFee = insurancePrice.fee;
From 844ecb228bff700a65d486d79f5a02996f396df0 Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Sat, 10 Feb 2018 19:14:13 -0500
Subject: [PATCH 034/457] Base mission nic pay balance; beta 3->2x nic;
participant bonus 2.5% nic per (#23)
---
.../MissionTargets/MissionTargetRewardCalculator.cs | 3 ++-
.../MissionEngine/Missions/MissionInProgress.cs | 11 ++++++++++-
.../Services/MissionEngine/Missions/MissionVisitor.cs | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/Perpetuum/Services/MissionEngine/MissionTargets/MissionTargetRewardCalculator.cs b/src/Perpetuum/Services/MissionEngine/MissionTargets/MissionTargetRewardCalculator.cs
index 5622a3e37..bea47a03e 100644
--- a/src/Perpetuum/Services/MissionEngine/MissionTargets/MissionTargetRewardCalculator.cs
+++ b/src/Perpetuum/Services/MissionEngine/MissionTargets/MissionTargetRewardCalculator.cs
@@ -67,7 +67,8 @@ private void PayAsMineral()
}
- public static readonly double[] PayOutMultipliers = new double[] { 25, 50, 100, 250, 500, 750, 1000, 1500, 2500, 4000 };
+ //Changed for Economy!
+ public static readonly double[] PayOutMultipliers = new double[] { 50, 75, 125, 250, 450, 600, 750, 1000, 1500, 2000 };
private void PayReward()
{
diff --git a/src/Perpetuum/Services/MissionEngine/Missions/MissionInProgress.cs b/src/Perpetuum/Services/MissionEngine/Missions/MissionInProgress.cs
index 0823ddadc..a5b049025 100644
--- a/src/Perpetuum/Services/MissionEngine/Missions/MissionInProgress.cs
+++ b/src/Perpetuum/Services/MissionEngine/Missions/MissionInProgress.cs
@@ -1444,6 +1444,15 @@ public void PayOutMission(double rewardFraction, List participants, L
double zoneFactor;
GetFinalReward(out rewardSum, out distanceReward, out difficultyReward, out rewardByTargets, out riskCompensation, out zoneFactor);
+ //TODO expose parameter in DB
+ //Modify total reward by participants
+ //Clamp participant count to [1,MaxmimalGangParticipants]
+ double participantBonus = 0.025;
+ int participantCount = Math.Min(MaxmimalGangParticipants, Math.Max(1, participants.Count));
+ double participantModifier = 1 + participantCount * participantBonus;
+ rewardSum *= participantModifier;
+ //--End participantbonus multiplier--//
+
paymentData.Add("totalReward", Math.Round(rewardSum));
paymentData.Add("distanceReward", distanceReward);
paymentData.Add("difficultyReward", difficultyReward);
@@ -2274,7 +2283,7 @@ public int CalculateEp()
{
if (myLocation.ZoneConfig.Type == ZoneType.Training) return 0;
var missionLevel = MissionLevel;
- if (missionLevel == 0) return 0; //level 0 missions ---> no ep
+ if (missionLevel == 0) return 1; //Change: level 0 -> 1ep
if (missionLevel == -1) { missionLevel = 1; } //10 training missions
var result = myMission.Targets.Count * Math.Pow(missionLevel, 0.5);
diff --git a/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs b/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs
index 32a518cfe..74ed0d681 100644
--- a/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs
+++ b/src/Perpetuum/Services/MissionEngine/Missions/MissionVisitor.cs
@@ -68,7 +68,7 @@ private void CalculateEstimation( )
private double ZoneFactor
{
- get { return _missionInProgress.myLocation.ZoneConfig.IsAlpha ? 1 : 3; }
+ get { return _missionInProgress.myLocation.ZoneConfig.IsAlpha ? 1 : 2; } //TODO: Beta multiplier!
}
From b05c7835954b15f45752fa787a6a282b30d82562 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sat, 10 Feb 2018 22:50:36 -0500
Subject: [PATCH 035/457] Loyal outpost bonus issue (#24)
Fix for outpost facility point allocations
---
.../Facilities/ProductionFacility.cs | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/Perpetuum/Services/ProductionEngine/Facilities/ProductionFacility.cs b/src/Perpetuum/Services/ProductionEngine/Facilities/ProductionFacility.cs
index f9d93b114..4d0dd3e6d 100644
--- a/src/Perpetuum/Services/ProductionEngine/Facilities/ProductionFacility.cs
+++ b/src/Perpetuum/Services/ProductionEngine/Facilities/ProductionFacility.cs
@@ -14,6 +14,7 @@
using Perpetuum.Services.Standing;
using Perpetuum.Units.DockingBases;
using Perpetuum.Zones;
+using Perpetuum.Zones.Intrusion;
namespace Perpetuum.Services.ProductionEngine.Facilities
{
@@ -35,13 +36,25 @@ protected ProductionFacility()
public MissionDataCache MissionDataCache { get; set; }
public DockingBaseHelper DockingBaseHelper { get; set; }
public ProductionInProgress.Factory ProductionInProgressFactory { get; set; }
- public RobotHelper RobotHelper { protected get; set; }
+ public RobotHelper RobotHelper { protected get; set; }
public override string ToString()
{
return $"{ED.Name} {ED.Definition} {Eid}";
}
+ private int GetFacilityBonus()
+ {
+ int modifier = 0;
+ var dockingbase = GetDockingBase();
+ if (dockingbase is Outpost)
+ {
+ ProductionFacility facility = (dockingbase as Outpost).GetProductionFacilities().Where(x => x.Eid == this.Eid).First();
+ modifier = Outpost.GetFacilityLevelFromStack(facility.Eid) * 25;
+ }
+ return modifier;
+ }
+
public virtual Dictionary GetFacilityInfo(Character character)
{
var infoData = BaseInfoToDictionary();
@@ -137,7 +150,7 @@ private bool LoadIsOnTrainingZone()
protected virtual int GetFacilityPoint()
{
- return ED.Options.Points;
+ return ED.Options.Points + GetFacilityBonus();
}
protected int GetPercentageFromAdditiveComponent(int additiveComponent)
From ed32b8db1e80a0b16b134e65a043a2762e52280e Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sat, 10 Feb 2018 23:51:11 -0500
Subject: [PATCH 036/457] Potential fix for Interzone Teleporters (#25)
---
src/Perpetuum/Zones/Teleporting/TeleportWorldTargetHelper.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Perpetuum/Zones/Teleporting/TeleportWorldTargetHelper.cs b/src/Perpetuum/Zones/Teleporting/TeleportWorldTargetHelper.cs
index 8f9fe9617..1ffaa2952 100644
--- a/src/Perpetuum/Zones/Teleporting/TeleportWorldTargetHelper.cs
+++ b/src/Perpetuum/Zones/Teleporting/TeleportWorldTargetHelper.cs
@@ -38,7 +38,8 @@ public IEnumerable GetWorldTargets(IZone zone,Position posi
.SetTargetZone(teleportColumn.Zone)
.SetTargetTeleport(teleportColumn)
.SetTargetRange(7)
- .SetListable(true);
+ .SetListable(true)
+ .SetActive(teleportColumn.IsEnabled);
var td = builder.Build();
result.Add(td);
From 0ad7a10453118afc98387dfec73682064567bfc1 Mon Sep 17 00:00:00 2001
From: mikejeffers
Date: Tue, 13 Feb 2018 22:39:48 -0500
Subject: [PATCH 037/457] rift exit temp fix for stronghold1
---
.../Services/RiftSystem/RiftManager.cs | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/Perpetuum/Services/RiftSystem/RiftManager.cs b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
index c5e95b34e..4b6fd3304 100644
--- a/src/Perpetuum/Services/RiftSystem/RiftManager.cs
+++ b/src/Perpetuum/Services/RiftSystem/RiftManager.cs
@@ -68,7 +68,7 @@ public class RiftManager
private readonly LinkedList _nextRiftSpawns = new LinkedList();
- public RiftManager(IZone zone,TimeRange spawnTime,RiftSpawnPositionFinder spawnPositionFinder,IEntityServices entityServices, ZoneManager zoneManager)
+ public RiftManager(IZone zone, TimeRange spawnTime, RiftSpawnPositionFinder spawnPositionFinder, IEntityServices entityServices, ZoneManager zoneManager)
{
_zone = zone;
_spawnTime = spawnTime;
@@ -87,7 +87,14 @@ public void Update(TimeSpan time)
_nextRiftSpawns.AddLast(new TimeTracker(FastRandom.NextTimeSpan(_spawnTime)));
Interlocked.Increment(ref _riftCounts);
}
-
+
+ //If exit rift dies on stronghold, respawn it
+ if (_riftCounts < 1 && _zone is StrongHoldZone)
+ {
+ _nextRiftSpawns.AddLast(new TimeTracker(FastRandom.NextTimeSpan(_spawnTime)));
+ Interlocked.Increment(ref _riftCounts);
+ }
+
_nextRiftSpawns.RemoveAll(t =>
{
t.Update(time);
@@ -136,6 +143,13 @@ private void SpawnRift()
}
var spawnPosition = _spawnPositionFinder.FindSpawnPosition().ToPosition();
+
+ if (_zone is StrongHoldZone)
+ {
+ //TODO: Fixme for I should be a DB table for valid spawn locations on strongholds
+ spawnPosition = new Position(1120, 1039);
+ }
+
rift.AddToZone(_zone, spawnPosition, ZoneEnterType.NpcSpawn);
Logger.Info(string.Format("Rift spawned on zone {0} {1} ({2}) Stronghold Zone ID: {3}", _zone.Id, rift.ED.Name, rift.CurrentPosition, rift.DestinationStrongholdZone));
}
From 204cd0374e581f10a3a0b4ee2966eb0f1320cad4 Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Fri, 16 Feb 2018 23:32:39 -0500
Subject: [PATCH 038/457] Price calculator probably should not be a single
instance object. (#27)
---
src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
index 1e3e77e81..9bf9db809 100644
--- a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
+++ b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
@@ -559,7 +559,7 @@ private void InitContainer(string gameRoot)
_builder.RegisterType().As().SingleInstance().OnActivated(e => e.Instance.Init());
_builder.RegisterType().SingleInstance();
- _builder.RegisterType().SingleInstance();
+ _builder.RegisterType(); // this doesn't appear to be something that should be a singleton.
_builder.RegisterType().As().SingleInstance();
From 477a80c2aac6306a6d24a9ba06e93ec9475a4eab Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Sat, 17 Feb 2018 10:47:08 -0500
Subject: [PATCH 039/457] Changes to startup sequence to ensure markets are
loaded properly after zones are created.
---
.../PerpetuumBootstrapper.cs | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
index 9bf9db809..030c8f56a 100644
--- a/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
+++ b/src/Perpetuum.Bootstrapper/PerpetuumBootstrapper.cs
@@ -288,7 +288,7 @@ public void Init(string gameRoot)
CorporationData.CorporationManager = _container.Resolve();
Character.CharacterFactory = _container.Resolve();
- Character.CharacterCache = _container.Resolve>().Invoke("CharacterCache");
+ Character.CharacterCache = _container.Resolve>().Invoke("CharacterCache");
MissionHelper.Init(_container.Resolve(), _container.Resolve());
MissionHelper.MissionProcessor = _container.Resolve();
@@ -354,6 +354,12 @@ public void Init(string gameRoot)
DefaultCorporationDataCache.LoadAll();
_container.Resolve().CacheMissionData();
+ // initialize our markets.
+ // this is dependent on all zones being loaded.
+ _container.Resolve().Init();
+ _container.Resolve().Init();
+
+
}
public bool TryInitUpnp(out bool success)
@@ -1516,12 +1522,9 @@ private void RegisterMissions()
}
private void InitRelayManager()
- {
- _builder.RegisterType().SingleInstance().OnActivated(e => e.Instance.Init());
- _builder.RegisterType().OnActivated(e =>
- {
- e.Instance.Init();
- }).SingleInstance();
+ {
+ _builder.RegisterType().SingleInstance();
+ _builder.RegisterType().SingleInstance();
_builder.RegisterType();
_builder.RegisterType().As();
From 251a20b0c0f23d5628ad47cb577a07df4c100f5b Mon Sep 17 00:00:00 2001
From: Mark Rutherford
Date: Mon, 19 Feb 2018 19:40:31 -0500
Subject: [PATCH 040/457] TransactionScope not completed when settings
corp-corp standings (#31)
---
src/Perpetuum.RequestHandlers/Standings/SetStanding.cs | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/Perpetuum.RequestHandlers/Standings/SetStanding.cs b/src/Perpetuum.RequestHandlers/Standings/SetStanding.cs
index b0818fc25..46c49d37b 100644
--- a/src/Perpetuum.RequestHandlers/Standings/SetStanding.cs
+++ b/src/Perpetuum.RequestHandlers/Standings/SetStanding.cs
@@ -115,8 +115,6 @@ public void HandleRequest(IRequest request)
.ToCorporation(targetCorporation, roleMask)
.Send();
}
-
- return;
}
Message.Builder.FromRequest(request)
From 775aa8a790624ffedd3f04f750fb57e108cfad8e Mon Sep 17 00:00:00 2001
From: Unavailable <2634337+MikeJeffers@users.noreply.github.com>
Date: Thu, 1 Mar 2018 20:31:00 -0500
Subject: [PATCH 041/457] Production costing--WIP (#32)
* production costs on bots working, tech levels working
* add docs and notes
* decrease owner facility cost recovery
---
.../ProductionEngine/Facilities/Mill.cs | 63 +++++++++--------
.../Facilities/ProductionFacility.cs | 8 +++
.../ProductionEngine/Facilities/Prototyper.cs | 6 +-
.../Facilities/ResearchLab.cs | 6 +-
.../ProductionEngine/PBSFacilities.cs | 2 +-
.../ProductionDataAccessExtensions.cs | 69 ++++++++++++++++---
.../ProductionEngine/ProductionProcessor.cs | 25 +++----
src/Perpetuum/Zones/Intrusion/Outpost.cs | 20 +++---
8 files changed, 128 insertions(+), 71 deletions(-)
diff --git a/src/Perpetuum/Services/ProductionEngine/Facilities/Mill.cs b/src/Perpetuum/Services/ProductionEngine/Facilities/Mill.cs
index 87516bc45..be60dc61f 100644
--- a/src/Perpetuum/Services/ProductionEngine/Facilities/Mill.cs
+++ b/src/Perpetuum/Services/ProductionEngine/Facilities/Mill.cs
@@ -29,8 +29,8 @@ public override Dictionary GetFacilityInfo(Character character)
infoDict.Add(k.percentageMaterial, GetPercentageFromAdditiveComponent(additiveComponentMaterial));
infoDict.Add(k.percentageTime, GetPercentageFromAdditiveComponent(additiveComponentTime));
- infoDict.Add(k.materialExtensionPoints, (int) GetMaterialExtensionBonus(character));
- infoDict.Add(k.timeExtensionPoints, (int) GetTimeExtensionBonus(character));
+ infoDict.Add(k.materialExtensionPoints, (int)GetMaterialExtensionBonus(character));
+ infoDict.Add(k.timeExtensionPoints, (int)GetTimeExtensionBonus(character));
infoDict.Add(k.cycle, 1);
infoDict.Add(k.rounds, GetMaxRounds(character));
@@ -42,7 +42,7 @@ public override ProductionFacilityType FacilityType
get { return ProductionFacilityType.MassProduce; }
}
- public static Mill CreateWithRandomEID(string definitionName)
+ public static Mill CreateWithRandomEID(string definitionName)
{
var mill = (Mill)Factory.CreateWithRandomEID(definitionName);
mill.CreateSystemStorage();
@@ -67,13 +67,13 @@ public override int RealMaxSlotsPerCharacter(Character character)
//
double extensionBonus = GetSlotExtensionBonus(character);
- return 1 + (int) (extensionBonus * (1 + standingRatio));
+ return 1 + (int)(extensionBonus * (1 + standingRatio));
}
public override int GetSlotExtensionBonus(Character character)
{
- return (int) character.GetExtensionsBonusSummary(ExtensionNames.PRODUCTION_MAX_MILL_SLOTS_BASIC, ExtensionNames.PRODUCTION_MAX_MILL_SLOTS_ADVANCED, ExtensionNames.PRODUCTION_MAX_MILL_SLOTS_EXPERT);
+ return (int)character.GetExtensionsBonusSummary(ExtensionNames.PRODUCTION_MAX_MILL_SLOTS_BASIC, ExtensionNames.PRODUCTION_MAX_MILL_SLOTS_ADVANCED, ExtensionNames.PRODUCTION_MAX_MILL_SLOTS_EXPERT);
}
public override double GetMaterialExtensionBonus(Character character)
@@ -94,7 +94,7 @@ private int GetAdditiveComponentForMaterial(Character character)
var standingPoints = GetStandingOfOwnerToCharacter(character) * 20;
var facilityPoints = GetFacilityPoint();
- return (int) (facilityPoints + standingPoints + extensionPoint);
+ return (int)(facilityPoints + standingPoints + extensionPoint);
}
@@ -104,7 +104,7 @@ private int GetAdditiveComponentForTime(Character character)
var standingComponent = GetStandingOfOwnerToCharacter(character) * 20;
var facilityPoints = GetFacilityPoint();
- return (int) (facilityPoints + extensionComponent + standingComponent);
+ return (int)(facilityPoints + extensionComponent + standingComponent);
}
@@ -145,7 +145,7 @@ public int CalculateFinalProductionTimeSeconds(Character character, int targetDe
var facilityProductionTime = GetProductionTimeSeconds();
- return (int) (facilityProductionTime * multiplier * durationModifier);
+ return (int)(facilityProductionTime * multiplier * durationModifier);
}
public IDictionary CalibrateLine(Character character, long calibrationEid, Container container)
@@ -155,18 +155,18 @@ public IDictionary CalibrateLine(Character character, long calib
lineCount.ThrowIfGreaterOrEqual(maxSlots, ErrorCodes.MaximumAmountOfProducionsReached);
- var calibrationItem = (CalibrationProgram) container.GetItemOrThrow(calibrationEid);
+ var calibrationItem = (CalibrationProgram)container.GetItemOrThrow(calibrationEid);
calibrationItem.Quantity.ThrowIfNotEqual(1, ErrorCodes.ServerError);
var targetDefinition = calibrationItem.TargetDefinition;
targetDefinition.ThrowIfEqual(0, ErrorCodes.CPRGNotProducible);
var targetDefault = EntityDefault.Get(targetDefinition);
-
+
calibrationItem.HasComponents.ThrowIfFalse(ErrorCodes.CPRGNotProducible);
-
+
//no mission stuff here
- if (calibrationItem.IsMissionRelated || targetDefault.CategoryFlags.IsCategory(CategoryFlags.cf_random_items) )
+ if (calibrationItem.IsMissionRelated || targetDefault.CategoryFlags.IsCategory(CategoryFlags.cf_random_items))
{
if (this.GetDockingBase().IsOnGammaZone())
{
@@ -243,7 +243,7 @@ public ProductionInProgress LineStart(Character character, ProductionLine produc
//so it can ask less that in the mission but never more
var preMatMult = materialMultiplier;
materialMultiplier = materialMultiplier.Clamp();
-
+
Logger.Info("pre material multiplier:" + preMatMult + " -> " + materialMultiplier);
}
@@ -273,7 +273,7 @@ public ProductionInProgress LineStart(Character character, ProductionLine produc
newProduction.resultDefinition = productionLine.TargetDefinition;
newProduction.totalProductionTimeSeconds = productionTimeSeconds;
newProduction.baseEID = Parent;
- newProduction.pricePerSecond = cprg.IsMissionRelated ? 0.0 : GetPricePerSecond();
+ newProduction.pricePerSecond = cprg.IsMissionRelated ? 0.0 : GetPricePerSecond(productionLine.TargetDefinition);
newProduction.ReservedEids = reservedEids;
newProduction.amountOfCycles = cycles;
newProduction.useCorporationWallet = useCorporationWallet;
@@ -339,8 +339,8 @@ public Dictionary QueryMaterialAndTime(CalibrationProgram calibr
ProductionLine.GetDecalibratedEfficiencies(lineOrCPRGMaterialPoints, lineOrCPRGTimePoints, decalibration.decrease, ref newMaterialEfficiency, ref newTimeEfficiency);
- lineOrCPRGMaterialPoints = (int) newMaterialEfficiency;
- lineOrCPRGTimePoints = (int) newTimeEfficiency;
+ lineOrCPRGMaterialPoints = (int)newMaterialEfficiency;
+ lineOrCPRGTimePoints = (int)newTimeEfficiency;
}
bool hasBonus;
@@ -350,23 +350,22 @@ public Dictionary QueryMaterialAndTime(CalibrationProgram calibr
{
materialMultiplier = materialMultiplier.Clamp(); //never ask more than what we have in the mission
}
-
+
var materials = ProductionDescription.GetRequiredComponentsInfo(ProductionInProgressType.massProduction, 1, materialMultiplier, calibrationProgram.Components);
materials.Count.ThrowIfEqual(0, ErrorCodes.WTFErrorMedicalAttentionSuggested);
var productionTimeSeconds = CalculateFinalProductionTimeSeconds(character, targetDefintion, lineOrCPRGTimePoints);
- var price = CalculateProductionPrice(productionTimeSeconds);
+ var price = CalculateProductionPrice(productionTimeSeconds, targetDefintion);
if (calibrationProgram.IsMissionRelated)
{
//mission stuff is fixed
- price = 0;
+ price = 0;
productionTimeSeconds = 10;
}
-
result.Add(k.materials, materials);
result.Add(k.productionTime, productionTimeSeconds);
result.Add(k.price, price);
@@ -378,9 +377,9 @@ public Dictionary QueryMaterialAndTime(CalibrationProgram calibr
}
- private long CalculateProductionPrice(int productionTime)
+ private long CalculateProductionPrice(int productionTime, int targetDefinition)
{
- return (long) (productionTime * GetPricePerSecond());
+ return (long)(productionTime * GetPricePerSecond(targetDefinition));
}
public override IDictionary EndProduction(ProductionInProgress productionInProgress, bool forced)
@@ -407,7 +406,7 @@ private IDictionary