Browse Source

Change to support new AcediaCore changes

feature_improvement
Anton Tarasenko 2 years ago
parent
commit
8ea048df03
  1. 4
      sources/Commands/ACommandGod.uc
  2. 6
      sources/Commands/ACommandInventory.uc
  3. 8
      sources/Commands/ACommandSpawn.uc
  4. 34
      sources/Commands/ACommandTrader.uc
  5. 2
      sources/Commands/ACommandUserData.uc

4
sources/Commands/ACommandGod.uc

@ -38,7 +38,7 @@ var private const int TDAMAGE, TMOMENTUM;
protected function Finalizer() protected function Finalizer()
{ {
_.memory.Free(announcer); _.memory.Free(announcer);
_.kf.health.OnDamage(self).Disconnect(); _server.kf.health.OnDamage(self).Disconnect();
super.Finalizer(); super.Finalizer();
} }
@ -62,7 +62,7 @@ protected function BuildData(CommandDataBuilder builder)
@ "affected by the momentum trasnferred from damaging attacks.")); @ "affected by the momentum trasnferred from damaging attacks."));
announcer = ACommandGod_Announcer( announcer = ACommandGod_Announcer(
_.memory.Allocate(class'ACommandGod_Announcer')); _.memory.Allocate(class'ACommandGod_Announcer'));
_.kf.health.OnDamage(self).connect = ProtectDivines; _server.kf.health.OnDamage(self).connect = ProtectDivines;
} }
protected function ExecutedFor( protected function ExecutedFor(

6
sources/Commands/ACommandInventory.uc

@ -239,7 +239,7 @@ protected function array<Text> LoadAllItemsLists(ArrayList specifiedLists)
} }
badLists = ListBuilder(_.memory.Allocate(class'ListBuilder')); badLists = ListBuilder(_.memory.Allocate(class'ListBuilder'));
callerConsole.Write(T(TLISTS_SKIPPED)); callerConsole.Write(T(TLISTS_SKIPPED));
availableLists = _.kf.templates.GetAvailableLists(); availableLists = _server.kf.templates.GetAvailableLists();
for (i = 0; i < specifiedLists.GetLength(); i += 1) for (i = 0; i < specifiedLists.GetLength(); i += 1)
{ {
nextList = specifiedLists.GetText(i); nextList = specifiedLists.GetText(i);
@ -270,14 +270,14 @@ protected function array<Text> LoadItemsList(
for (i = 0; i < availableLists.length; i += 1) for (i = 0; i < availableLists.length; i += 1)
{ {
if (availableLists[i].Compare(listName, SCASE_INSENSITIVE)) { if (availableLists[i].Compare(listName, SCASE_INSENSITIVE)) {
return _.kf.templates.GetItemList(availableLists[i]); return _server.kf.templates.GetItemList(availableLists[i]);
} }
} }
// Prefix matching otherwise // Prefix matching otherwise
for (i = 0; i < availableLists.length; i += 1) for (i = 0; i < availableLists.length; i += 1)
{ {
if (availableLists[i].StartsWith(listName, SCASE_INSENSITIVE)) { if (availableLists[i].StartsWith(listName, SCASE_INSENSITIVE)) {
return _.kf.templates.GetItemList(availableLists[i]); return _server.kf.templates.GetItemList(availableLists[i]);
} }
} }
badLists.Item(listName); badLists.Item(listName);

8
sources/Commands/ACommandSpawn.uc

@ -82,7 +82,7 @@ private final function SpawnAt(
{ {
local EPlaceable result; local EPlaceable result;
result = _.kf.world.Spawn(template, spawnLocation); result = _server.kf.world.Spawn(template, spawnLocation);
if (result != none) { if (result != none) {
announcer.AnnounceSpawned(template); announcer.AnnounceSpawned(template);
} }
@ -100,21 +100,21 @@ private final function SpawnInInstigatorSight(
local Vector spawnLocation; local Vector spawnLocation;
local TracingIterator iter; local TracingIterator iter;
iter = _.kf.world.TracePlayerSight(instigator).LeaveOnlyVisible(); iter = _server.kf.world.TracePlayerSight(instigator).LeaveOnlyVisible();
if (iter.HasFinished()) if (iter.HasFinished())
{ {
announcer.AnnounceFailedTrace(); announcer.AnnounceFailedTrace();
return; return;
} }
spawnLocation = iter.GetHitLocation(); spawnLocation = iter.GetHitLocation();
result = _.kf.world.Spawn(template, spawnLocation); result = _server.kf.world.Spawn(template, spawnLocation);
// Shift position back a little and try again; // Shift position back a little and try again;
// this should fix a ton of spawning failures // this should fix a ton of spawning failures
if (result == none) if (result == none)
{ {
spawnLocation = spawnLocation + spawnLocation = spawnLocation +
Normal(iter.GetTracingStart() - spawnLocation) * 100; Normal(iter.GetTracingStart() - spawnLocation) * 100;
result = _.kf.world.Spawn(template, spawnLocation); result = _server.kf.world.Spawn(template, spawnLocation);
} }
if (result != none) { if (result != none) {
announcer.AnnounceSpawned(template); announcer.AnnounceSpawned(template);

34
sources/Commands/ACommandTrader.uc

@ -109,11 +109,11 @@ protected function Executed(CallData arguments, EPlayer instigator)
{ {
newTradingStatus = arguments.parameters.GetBool(T(TENABLE)); newTradingStatus = arguments.parameters.GetBool(T(TENABLE));
if ( arguments.parameters.GetBool(T(TENABLE)) if ( arguments.parameters.GetBool(T(TENABLE))
== _.kf.trading.IsTradingActive()) == _server.kf.trading.IsTradingActive())
{ {
announcer.AnnounceTradingNoChange(); announcer.AnnounceTradingNoChange();
} }
_.kf.trading.SetTradingStatus(newTradingStatus); _server.kf.trading.SetTradingStatus(newTradingStatus);
if (newTradingStatus) { if (newTradingStatus) {
announcer.AnnounceActivatedTrading(); announcer.AnnounceActivatedTrading();
} }
@ -159,7 +159,7 @@ protected function ListTradersFor(EPlayer target)
if (target == none) { if (target == none) {
return; return;
} }
availableTraders = _.kf.trading.GetTraders(); availableTraders = _server.kf.trading.GetTraders();
callerConsole.Flush() callerConsole.Flush()
.UseColorOnce(_.color.TextEmphasis).Write(T(TLIST_TRADERS)); .UseColorOnce(_.color.TextEmphasis).Write(T(TLIST_TRADERS));
closestTrader = FindClosestTrader(target); closestTrader = FindClosestTrader(target);
@ -185,11 +185,11 @@ protected function HandleTraderTime(CallData result)
parameter = result.parameters.GetText(T(TTRADER_TIME)); parameter = result.parameters.GetText(T(TTRADER_TIME));
if (parameter.Compare(T(TPAUSE), SCASE_INSENSITIVE)) if (parameter.Compare(T(TPAUSE), SCASE_INSENSITIVE))
{ {
oldIsPaused = _.kf.trading.IsCountDownPaused(); oldIsPaused = _server.kf.trading.IsCountDownPaused();
if (!oldIsPaused) { if (!oldIsPaused) {
_.kf.trading.SetCountdownPause(true); _server.kf.trading.SetCountdownPause(true);
} }
newIsPaused = _.kf.trading.IsCountDownPaused(); newIsPaused = _server.kf.trading.IsCountDownPaused();
if (oldIsPaused != newIsPaused) { if (oldIsPaused != newIsPaused) {
announcer.AnnouncePausedTime(); announcer.AnnouncePausedTime();
} }
@ -197,11 +197,11 @@ protected function HandleTraderTime(CallData result)
} }
else if (parameter.Compare(T(TUNPAUSE), SCASE_INSENSITIVE)) else if (parameter.Compare(T(TUNPAUSE), SCASE_INSENSITIVE))
{ {
oldIsPaused = _.kf.trading.IsCountDownPaused(); oldIsPaused = _server.kf.trading.IsCountDownPaused();
if (oldIsPaused) { if (oldIsPaused) {
_.kf.trading.SetCountdownPause(false); _server.kf.trading.SetCountdownPause(false);
} }
newIsPaused = _.kf.trading.IsCountDownPaused(); newIsPaused = _server.kf.trading.IsCountDownPaused();
if (oldIsPaused != newIsPaused) { if (oldIsPaused != newIsPaused) {
announcer.AnnounceUnpausedTime(); announcer.AnnounceUnpausedTime();
} }
@ -210,8 +210,8 @@ protected function HandleTraderTime(CallData result)
parser = _.text.Parse(parameter); parser = _.text.Parse(parameter);
if (parser.MInteger(countDownValue).Ok()) if (parser.MInteger(countDownValue).Ok())
{ {
_.kf.trading.SetCountdown(countDownValue); _server.kf.trading.SetCountdown(countDownValue);
announcer.AnnounceChangedCountdown(_.kf.trading.GetCountdown()); announcer.AnnounceChangedCountdown(_server.kf.trading.GetCountdown());
} }
else else
{ {
@ -277,7 +277,7 @@ protected function SelectTrader(CallData result, EPlayer callerPlayer)
local Text specifiedTraderName; local Text specifiedTraderName;
local ETrader previouslySelectedTrader, newlySelectedTrader; local ETrader previouslySelectedTrader, newlySelectedTrader;
previouslySelectedTrader = _.kf.trading.GetSelectedTrader(); previouslySelectedTrader = _server.kf.trading.GetSelectedTrader();
specifiedTraderName = result.parameters.GetText(T(TTRADER)); specifiedTraderName = result.parameters.GetText(T(TTRADER));
// Try to get trader user want to select: // Try to get trader user want to select:
// first try closes (if option is specified), next trader's name // first try closes (if option is specified), next trader's name
@ -285,7 +285,7 @@ protected function SelectTrader(CallData result, EPlayer callerPlayer)
newlySelectedTrader = FindClosestTrader(callerPlayer); newlySelectedTrader = FindClosestTrader(callerPlayer);
} }
if (newlySelectedTrader == none) { if (newlySelectedTrader == none) {
newlySelectedTrader = _.kf.trading.GetTrader(specifiedTraderName); newlySelectedTrader = _server.kf.trading.GetTrader(specifiedTraderName);
} }
// If nothing is found, but name was specified - there is an error // If nothing is found, but name was specified - there is an error
if (newlySelectedTrader == none && specifiedTraderName != none) if (newlySelectedTrader == none && specifiedTraderName != none)
@ -298,7 +298,7 @@ protected function SelectTrader(CallData result, EPlayer callerPlayer)
} }
// Select proper trader // Select proper trader
HandleTraderSwap(result, previouslySelectedTrader, newlySelectedTrader); HandleTraderSwap(result, previouslySelectedTrader, newlySelectedTrader);
_.kf.trading.SelectTrader(newlySelectedTrader); _server.kf.trading.SelectTrader(newlySelectedTrader);
// Report change // Report change
if (AreTradersSame(previouslySelectedTrader, newlySelectedTrader)) { if (AreTradersSame(previouslySelectedTrader, newlySelectedTrader)) {
announcer.AnnounceSelectedSameTrader(); announcer.AnnounceSelectedSameTrader();
@ -352,7 +352,7 @@ protected function BootFromTraders(CallData result, EPlayer callerPlayer)
affectedTraderList = ListBuilder(_.memory.Allocate(class'ListBuilder')); affectedTraderList = ListBuilder(_.memory.Allocate(class'ListBuilder'));
selectedTraders = GetTradersArray(result, callerPlayer); selectedTraders = GetTradersArray(result, callerPlayer);
if (selectedTraders.length <= 0) { if (selectedTraders.length <= 0) {
selectedTraders = _.kf.trading.GetTraders(); selectedTraders = _server.kf.trading.GetTraders();
} }
for (i = 0; i < selectedTraders.length; i += 1) for (i = 0; i < selectedTraders.length; i += 1)
{ {
@ -441,7 +441,7 @@ protected function array<ETrader> GetTradersArray(
local array<ETrader> resultTraders; local array<ETrader> resultTraders;
local array<ETrader> availableTraders; local array<ETrader> availableTraders;
// Boundary cases: all traders and no traders at all // Boundary cases: all traders and no traders at all
availableTraders = _.kf.trading.GetTraders(); availableTraders = _server.kf.trading.GetTraders();
if (result.options.HasKey(T(TALL))) { if (result.options.HasKey(T(TALL))) {
return availableTraders; return availableTraders;
} }
@ -547,7 +547,7 @@ protected function ETrader FindClosestTrader(EPlayer target)
return none; return none;
} }
targetLocation = target.GetLocation(); targetLocation = target.GetLocation();
availableTraders = _.kf.trading.GetTraders(); availableTraders = _server.kf.trading.GetTraders();
for (i = 0; i < availableTraders.length; i += 1) for (i = 0; i < availableTraders.length; i += 1)
{ {
newDistance = newDistance =

2
sources/Commands/ACommandUserData.uc

@ -106,7 +106,7 @@ private final function UserDataRead(
asJSON = _.json.PrettyPrint(userData); asJSON = _.json.PrettyPrint(userData);
targetPlayer.BorrowConsole() targetPlayer.BorrowConsole()
.Write(F("{$TextPositive User data for player}")) .Write(F("{$TextPositive User data for player}"))
.Write(targetPlayerName); .Write(targetPlayerName)
.Write(P(":")) .Write(P(":"))
.WriteLine(asJSON); .WriteLine(asJSON);
_.memory.Free(targetPlayer); _.memory.Free(targetPlayer);

Loading…
Cancel
Save