mirror of
https://github.com/UOX3DevTeam/UOX3
synced 2026-08-13 12:27:04 -04:00
Removed arbitrary and hidden restrictions on refreshing list of online players shown with 'wholist command
Fixed an issue where player ghosts that get teleported would not see themselves get updated to new location
Fixed a server crash from clients disconnecting while running server in debug mode
Improved how container updates are sent to players; now only sends to clients that have actually opened the container, and who are still within range
Added more information about UO data files being loaded during server startup
Enhanced the GM 'add menu to allow clicking directly on images of items/npcs to add them, and adjusted size of menus to accommodate this
Fixed an issue with fleeing NPCs that could cause them to attempt to flee across time and space, regardless of distance to target/attacker in combat
Added NPC AI that runs away from players if they get too close (even outside combat). Applied to hind, rabbits, squirrels, ferrets and various birds by default:
AI_ANIMAL_SCARED (aitype 12)
Fixed issues with NPCs fleeing forever, or getting stuck in flee/don't flee loop, by introducing max fleeing distance (50 tiles) and cooldown (30 sec) on fleeing
Updated onNameRequest JS Event to include third parameter with origin of name request, so script responses can be tailored appropriately:
onNameRequest( myObj, requestedBy, requestSource )
Potential values for requestSource:
0 - Speech/System Messages
1 - Guild Menus
2 - Stat Window (self)
3 - Stat Window (other)
4 - Tooltip
5 - Paperdoll Journal
6 - Paperdoll
7 - Single Click / All-Names
8 - System
9 - Secure Trade Window
Added Adaptive Performance System (APS) that dynamically adjust how often NPC AI/movement is checked based on overall shard performance. If performance drops below defined threshold, UOX3 gradually slows down checks for NPC AI/movement to prioritize player movement/speech/command responsiveness. If performance climbs back up above threshold, slowdowns are gradually removed. The following UOX.INI options have been added under [system] category to support this system:
APSPERFTHRESHOLD=50 // Performance threshold (measured in simulation cycles/sec) below which the APS kicks in
APSINTERVAL=100 // How often (in milliseconds) the APS checks performance and makes adjustments (if needed) to balance out shard performance
APSDELAYSTEP=50 // How much the delay timer is modified by (in milliseconds) each time APS makes adjustments
APSDELAYMAXCAP=2000 // Max amount of of delay APS can introduce for NPC AI/movement handling when attempting to restore shard performance
Added new JS Methods for Region objects:
.GetOrePrefs( oreType ) // Get ore preference data for ore type found in town region. Returned as an array containing the following data:
orePrefData -> [
oreName, // name of ore
color, // color of ore
minskill, // min skill to mine ore
ingotName, // name of ingot created from ore
makemenu, // makemenu entry for crafting something from ingot
oreChance, // default global chance of finding this ore type
scriptID // script attached to mined ore
],
orePrefChance // Chance of finding this ore type in given town region
.GetOreChance() // Get base chance of finding any ore in town region
Moved Mining skill plus gravedigging feature from hard code to scripts (js/skill/mining.js) to make it easier to maintain and/or customize, and removed hard coded variants
Gravedigging now relies on the ore resource system behind the scenes to restrict how often graves in a given area can be dug up
Fixed some incorrect references to .worldNumber Character property in misc scripts (should be .worldnumber)
Made some "hard-scripted" system messages in misc scripts use dictionary system instead
Added spawn region for banker NPCs in Serpent's Hold (dfndata/spawn/felucca/spawn_town_serpents_hold.dfn, dfndata/spawn/trammel/spawn_town_serpents_hold.dfn)
Fixed region definition of Ocllo to actually cover the entire town (dfndata/regions/regions.dfn)
Added numerous additional locations accessible with 'goplace # command, for key locations in Ilshenar, Malas, Tokuno Islands and Ter Mur (dfndata/location/location.dfn)
Revised travel-menu portion of GM menu (shortcut: 'travel) to include more travel options based on new locations (dfndata/items/travelmenu.dfn and travelmenu.bulk.dfn)
Fixed an issue where NPCs could attempt to attack targets in other worlds/instances
Added new JS Event that triggers for characters who are about to deal damage in combat. Complimentary to onDamage, which triggers for chars receiving damage:
onDamageDeal( dmgDealer, dmgReceiver, damageValue, damageType )
Added new JS Event that can trigger in global script upon creation of new player chars. Note that this will trigger in place of onCreateDFN event for player characters:
onCreatePlayer( pChar )
Added new JS Event that triggers for characters selecting a target with a spell. Complimentary to onSpellTarget, which triggers for targets selected with a spell:
onSpellTargetSelect( caster, target, spellNum )
Updated onCombatStart and onCombatEnd JS Events to also trigger for the other party in combat
Updated onPickup JS Event to include a third parameter - the potential container item was picked up from. Event now also triggers event in scripts attached to said containers:
onPickup( iPickedUp, pChar, iCont )
Added tracking of total playtime per individual character, and per account across all characters, and exposed these properties to JS engine:
.totalPlayTime // Account property, total playtime across all chars
.playTime // Character property, total playtime on given character only
Added new player-accessible command ('playtime) to spit out the playtime of current character/account as a whole (js/commands/playtime.js)
Implemented first version of Young Player System:
Replaced the UNUSED9 account flag with YOUNG, to be used by Young/New Player System
Added new JS Account property that gets/sets whether player account is considered Young:
.isYoung
Added new Char timers:
TIMER_YOUNGHEAL // Restricts how often Young players are healed by NPC healers
TIMER_YOUNGMESSAGE // Restricts how often Young players are warned about dangerous looking monsters in overworld
Updated GM commands 'get and 'set to get/set .isYoung property of player's account (js/commands/targeting/get.js and set.js)
Added new UOX.INI setting to enable/disable Young Player System (enabled by default):
YOUNGPLAYERSYSTEM=1
If Young Player System is enabled, all newly created player accounts are automatically marked with Young flag
Added new script to handle various restrictions and functions related to Young characters (js/player/young_player.js):
Young characters will have [Young] displayed over their head
Young characters will have their Young status checked and verified on every login + every stat/skill gain, to revoke the Young status if any of the following is true:
Account has a total playtime of more than 40 hours
Any character has more than 350 total (base) skill points
Any character has more than 70 skill points in a single skill
Any character has more than 150 total stat points
Any character has more than 80 stat points in a single stat
Young characters can renounce their Young status manually by saying the words "I renounce my young player status"
Young characters get two additional items upon creation:
a new player ticket (can be combined with any other players new player ticket for both players to get a reward)
a sextant (shows Young players directions to nearest moongate/bank regardless of where they are, as long as outdoors)
Young characters cannot target other player characters with hostile spells or skills
Young characters cannot be the target of other player characters' hostile spells or skills
Young characters can only cast beneficial spells upon themselves or other Young characters
Young characters can only be the target of beneficial spells from other Young players
Young players (and their pets/followers) cannot attack or harm any other players (or their pets/followers), nor themselves be attacked or harmed by any other players (or their pets/followers), whether from combat, spells, skills or items
Young players don't lose any of their items on death, and are teleported to the nearest healer upon death with all their items intact
Young players receive a warning upon entering dungeons that monsters there will be hostile
Updated global script (js/server/global.js) to:
Check/Verify Young status of players upon login
Attach young player script on login/creation for players on Young accounts
Give specific items to Young players upon creation
Added new script (js/item/corpse.js) that is assigned to all freshly created corpses. This script handles restrictions related to Young players interactions with corpses, and the interactions of other players with corpses of Young players
Updated JS Method .Carve() to return true/false depending on whether carving a corpse was successful
Updated Healer AI in code to heal nearby injured Young players
Updated Evil AI and Evil Caster AI in code to avoid selecting Young players as targets in combat outside of dungeons
Added a new section to UOX.INI - [young player starting locations] - that can be used to define starting locations for Young players. If only one such location is provided, all players start there. Otherwise, it matches the same starting location setup as the regular one - with one entry per town in Britannia.
Restricted transferring and/or friending of pets (code) and hirelings (hirelings.js) between Young and non-Young players
Restricted Young players from recalling or gating to Felucca facet
Young players can instantly logout from anywhere, at any time
407 lines
13 KiB
C++
407 lines
13 KiB
C++
#include "uox3.h"
|
|
#include "classes.h"
|
|
#include "CPacketSend.h"
|
|
#include "ObjectFactory.h"
|
|
|
|
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Function - SendTradeStatus()
|
|
//| Date - February 2, 2006
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Purpose - Updates the status of the secure trade buttons (checked or unchecked) to both clients
|
|
//o------------------------------------------------------------------------------------------------o
|
|
void SendTradeStatus( CSocket *mSock, CSocket *nSock, CItem *tradeWindowOne, CItem *tradeWindowTwo )
|
|
{
|
|
CPSecureTrading cpstOne(( *tradeWindowOne ), ( tradeWindowOne->GetTempVar( CITV_MOREZ ) % 256), ( tradeWindowTwo->GetTempVar( CITV_MOREZ ) % 256 ));
|
|
cpstOne.Action( 2 );
|
|
mSock->Send( &cpstOne );
|
|
|
|
CPSecureTrading cpstTwo(( *tradeWindowTwo ), ( tradeWindowTwo->GetTempVar( CITV_MOREZ ) % 256), ( tradeWindowOne->GetTempVar( CITV_MOREZ ) % 256 ));
|
|
cpstTwo.Action( 2 );
|
|
nSock->Send( &cpstTwo );
|
|
}
|
|
void SendTradeStatus( CItem *tradeWindowOne, CItem *tradeWindowTwo )
|
|
{
|
|
CChar *p1 = FindItemOwner( tradeWindowOne );
|
|
CChar *p2 = FindItemOwner( tradeWindowTwo );
|
|
if( !ValidateObject( p1 ) || !ValidateObject( p2 ))
|
|
return;
|
|
|
|
CSocket *s1 = p1->GetSocket();
|
|
CSocket *s2 = p2->GetSocket();
|
|
if( s1 != nullptr && s2 != nullptr )
|
|
{
|
|
SendTradeStatus( s1, s2, tradeWindowOne, tradeWindowTwo );
|
|
}
|
|
}
|
|
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Function - CreateTradeWindow()
|
|
//| Date - February 2, 2006
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Purpose - Creates a TradeWindow and sends it to the clients
|
|
//o------------------------------------------------------------------------------------------------o
|
|
CItem *CreateTradeWindow( CSocket *mSock, CSocket *nSock, CChar *mChar )
|
|
{
|
|
CItem *mPack = mChar->GetPackItem();
|
|
if( !ValidateObject( mPack ))
|
|
{
|
|
mSock->SysMessage( 773 ); // Time to buy a backpack.
|
|
nSock->SysMessage( 1357, mChar->GetNameRequest( nSock->CurrcharObj(), NRS_SPEECH ).c_str() ); // %s doesn't have a backpack!
|
|
return nullptr;
|
|
}
|
|
|
|
CItem *tradeWindow = Items->CreateItem( nullptr, mChar, 0x1E5E, 1, 0, OT_ITEM, false );
|
|
if( !ValidateObject( tradeWindow ))
|
|
return nullptr;
|
|
|
|
tradeWindow->SetType( IT_TRADEWINDOW );
|
|
tradeWindow->SetCont( mChar );
|
|
tradeWindow->SetX( 0 );
|
|
tradeWindow->SetY( 0 );
|
|
tradeWindow->SetZ( 0 );
|
|
tradeWindow->SetDye( false );
|
|
tradeWindow->SetTempVar( CITV_MOREZ, 0 );
|
|
tradeWindow->SetDecayable( false );
|
|
|
|
tradeWindow->SendPackItemToSocket( mSock );
|
|
tradeWindow->SendPackItemToSocket( nSock );
|
|
|
|
return tradeWindow;
|
|
}
|
|
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Function - StartTrade()
|
|
//| Date - February 2, 2006
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Purpose - Handles everything necesarry to start a secure trade
|
|
//o------------------------------------------------------------------------------------------------o
|
|
CItem *StartTrade( CSocket *mSock, CChar *nChar )
|
|
{
|
|
if( mSock == nullptr || !ValidateObject( nChar ))
|
|
return nullptr;
|
|
|
|
CChar *mChar = mSock->CurrcharObj();
|
|
CSocket *nSock = nChar->GetSocket();
|
|
|
|
if( !ValidateObject( mChar ) || nSock == nullptr )
|
|
return nullptr;
|
|
|
|
CItem *tradeWindowOne = CreateTradeWindow( mSock, nSock, mChar );
|
|
if( !ValidateObject( tradeWindowOne ))
|
|
return nullptr;
|
|
|
|
CItem *tradeWindowTwo = CreateTradeWindow( nSock, mSock, nChar );
|
|
if( !ValidateObject( tradeWindowTwo ))
|
|
{
|
|
tradeWindowOne->Delete();
|
|
return nullptr;
|
|
}
|
|
|
|
const SERIAL tw1Serial = tradeWindowOne->GetSerial();
|
|
const SERIAL tw2Serial = tradeWindowTwo->GetSerial();
|
|
|
|
tradeWindowOne->SetTempVar( CITV_MOREX, tw2Serial );
|
|
tradeWindowTwo->SetTempVar( CITV_MOREX, tw1Serial );
|
|
|
|
CPSecureTrading cpstOne(( *nChar ), tw1Serial, tw2Serial );
|
|
cpstOne.Name( nChar->GetNameRequest( mChar, NRS_SECURETRADE ));
|
|
mSock->Send( &cpstOne );
|
|
|
|
CPSecureTrading cpstTwo(( *mChar ), tw2Serial, tw1Serial );
|
|
cpstTwo.Name( mChar->GetNameRequest( nChar, NRS_SECURETRADE ));
|
|
nSock->Send( &cpstTwo );
|
|
|
|
CPWornItem toWear = ( *tradeWindowOne );
|
|
mSock->Send( &toWear );
|
|
nSock->Send( &toWear );
|
|
|
|
CPWornItem toWear2 = ( *tradeWindowTwo );
|
|
mSock->Send( &toWear2 );
|
|
nSock->Send( &toWear2 );
|
|
|
|
return tradeWindowOne;
|
|
}
|
|
|
|
bool ClearTradesFunctor( CBaseObject *a, UI32 &b, [[maybe_unused]] void *extraData )
|
|
{
|
|
bool retVal = true;
|
|
if( ValidateObject( a ) && a->CanBeObjType( OT_ITEM ))
|
|
{
|
|
// Body of the functor goes here
|
|
CItem *i = static_cast<CItem *>( a );
|
|
if( ValidateObject( i ))
|
|
{
|
|
if( i->GetType() == IT_TRADEWINDOW )
|
|
{
|
|
// Find owner of trade window (each player has their own)
|
|
CChar *tradeWindowOwner = FindItemOwner( i );
|
|
if( ValidateObject( tradeWindowOwner ))
|
|
{
|
|
// Fetch backpack of owner of trade window
|
|
CItem *ownerPack = tradeWindowOwner->GetPackItem();
|
|
if( ValidateObject( ownerPack ))
|
|
{
|
|
// Iterate through all objects in trade window
|
|
GenericList<CItem *> *iCont = i->GetContainsList();
|
|
for( CItem *j = iCont->First(); !iCont->Finished(); j = iCont->Next() )
|
|
{
|
|
if( ValidateObject( j ))
|
|
{
|
|
// Delete pet transfer deeds - they only live inside trade windows
|
|
if( j->GetType() == IT_PETTRANSFERDEED )
|
|
{
|
|
j->Delete();
|
|
continue;
|
|
}
|
|
|
|
// Throw item from trade window back into owner's backpack
|
|
j->SetCont( ownerPack );
|
|
|
|
// Store a timestamp indicating when item last left secure trade window
|
|
j->SetTempLastTraded( cwmWorldState->GetUICurrentTime() );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
i->Delete();
|
|
++b; // let's track how many we cleared
|
|
}
|
|
}
|
|
}
|
|
return retVal;
|
|
}
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Function - ClearTrades()
|
|
//| Date - February 2, 2006
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Purpose - Loops through all items to clear any active trades
|
|
//o------------------------------------------------------------------------------------------------o
|
|
void ClearTrades( void )
|
|
{
|
|
UI32 b = 0;
|
|
ObjectFactory::GetSingleton().IterateOver( OT_ITEM, b, nullptr, &ClearTradesFunctor );
|
|
}
|
|
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Function - CompleteTrade()
|
|
//| Date - February 2, 2006
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Purpose - Handles everything necesarry to complete a trade
|
|
//o------------------------------------------------------------------------------------------------o
|
|
void CompleteTrade( CItem *tradeWindowOne, CItem *tradeWindowTwo, bool tradeSuccess )
|
|
{
|
|
CChar *p1 = FindItemOwner( tradeWindowOne );
|
|
CChar *p2 = FindItemOwner( tradeWindowTwo );
|
|
if( !ValidateObject( p1 ) || !ValidateObject( p2 ))
|
|
return;
|
|
|
|
CSocket *mSock = p1->GetSocket();
|
|
if( mSock != nullptr )
|
|
{
|
|
CPSecureTrading cpstOne(( *tradeWindowOne ));
|
|
cpstOne.Action( 1 );
|
|
mSock->Send( &cpstOne );
|
|
}
|
|
CSocket *nSock = p2->GetSocket();
|
|
if( nSock != nullptr )
|
|
{
|
|
CPSecureTrading cpstTwo(( *tradeWindowTwo ));
|
|
cpstTwo.Action( 1 );
|
|
nSock->Send( &cpstTwo );
|
|
}
|
|
|
|
CItem *bp1 = p1->GetPackItem();
|
|
CItem *bp2 = p2->GetPackItem();
|
|
if( ValidateObject( bp1 ) && ValidateObject( bp2 ))
|
|
{
|
|
CItem *i = nullptr;
|
|
GenericList<CItem *> *c1Cont = tradeWindowOne->GetContainsList();
|
|
for( i = c1Cont->First(); !c1Cont->Finished(); i = c1Cont->Next() )
|
|
{
|
|
if( ValidateObject( i ))
|
|
{
|
|
if( tradeSuccess )
|
|
{
|
|
if( i->GetType() == IT_PETTRANSFERDEED )
|
|
{
|
|
// Find serial of pet
|
|
SERIAL petSerial = i->GetTempVar( CITV_MORE );
|
|
if( petSerial != INVALIDSERIAL )
|
|
{
|
|
CChar *petChar = CalcCharObjFromSer( petSerial );
|
|
if( ValidateObject( petChar ))
|
|
{
|
|
// Transfer pet to other player
|
|
Npcs->FinalizeTransfer( petChar, p1, p2 );
|
|
}
|
|
}
|
|
|
|
// Delete pet transfer deed
|
|
i->Delete();
|
|
continue;
|
|
}
|
|
|
|
// Move transferred item to other player
|
|
i->SetCont( bp2 );
|
|
}
|
|
else
|
|
{
|
|
if( i->GetType() == IT_PETTRANSFERDEED )
|
|
{
|
|
// Delete pet transfer deed
|
|
i->Delete();
|
|
continue;
|
|
}
|
|
|
|
// Move item back to original player's backpack
|
|
i->SetCont( bp1 );
|
|
}
|
|
i->PlaceInPack();
|
|
|
|
// Store a timestamp indicating when item last left secure trade window
|
|
i->SetTempLastTraded( cwmWorldState->GetUICurrentTime() );
|
|
}
|
|
}
|
|
GenericList<CItem *> *c2Cont = tradeWindowTwo->GetContainsList();
|
|
for( i = c2Cont->First(); !c2Cont->Finished(); i = c2Cont->Next() )
|
|
{
|
|
if( ValidateObject( i ))
|
|
{
|
|
if( tradeSuccess )
|
|
{
|
|
if( i->GetType() == IT_PETTRANSFERDEED )
|
|
{
|
|
// Find serial of pet
|
|
SERIAL petSerial = i->GetTempVar( CITV_MORE );
|
|
if( petSerial != INVALIDSERIAL )
|
|
{
|
|
CChar *petChar = CalcCharObjFromSer( petSerial );
|
|
if( ValidateObject( petChar ))
|
|
{
|
|
// Transfer pet to other player
|
|
Npcs->FinalizeTransfer( petChar, p2, p1 );
|
|
}
|
|
}
|
|
|
|
// Delete pet transfer deed
|
|
i->Delete();
|
|
continue;
|
|
}
|
|
|
|
// Move transferred item to other player
|
|
i->SetCont( bp1 );
|
|
}
|
|
else
|
|
{
|
|
if( i->GetType() == IT_PETTRANSFERDEED )
|
|
{
|
|
// Delete pet transfer deed
|
|
i->Delete();
|
|
continue;
|
|
}
|
|
|
|
// Move item back to original player's backpack
|
|
i->SetCont( bp2 );
|
|
}
|
|
i->PlaceInPack();
|
|
|
|
// Store a timestamp indicating when item last left secure trade window
|
|
i->SetTempLastTraded( cwmWorldState->GetUICurrentTime() );
|
|
}
|
|
}
|
|
}
|
|
|
|
tradeWindowOne->Delete();
|
|
tradeWindowTwo->Delete();
|
|
}
|
|
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Function - CancelTrade()
|
|
//| Date - February 2, 2006
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Purpose - Cancels a secure trade
|
|
//o------------------------------------------------------------------------------------------------o
|
|
void CancelTrade( CItem *tradeWindowOne )
|
|
{
|
|
CItem *tradeWindowTwo = CalcItemObjFromSer( tradeWindowOne->GetTempVar( CITV_MOREX ));
|
|
if( !ValidateObject( tradeWindowTwo ))
|
|
return;
|
|
|
|
tradeWindowOne->SetTempVar( CITV_MOREZ, 0 );
|
|
tradeWindowTwo->SetTempVar( CITV_MOREZ, 0 );
|
|
SendTradeStatus( tradeWindowOne, tradeWindowTwo );
|
|
|
|
CompleteTrade( tradeWindowOne, tradeWindowTwo, false );
|
|
}
|
|
|
|
bool CPITradeMessage::Handle( void )
|
|
{
|
|
CItem *tradeWindowOne = CalcItemObjFromSer( tSock->GetDWord( 4 ));
|
|
if( ValidateObject( tradeWindowOne ))
|
|
{
|
|
CItem *tradeWindowTwo = nullptr;
|
|
switch( tSock->GetByte( 3 ))
|
|
{
|
|
case 0: // Start trade - Never happens, sent out by the server only.
|
|
break;
|
|
case 2: // Change check marks. Possibly conclude trade
|
|
tradeWindowTwo = CalcItemObjFromSer( tradeWindowOne->GetTempVar( CITV_MOREX ));
|
|
if( ValidateObject( tradeWindowTwo ))
|
|
{
|
|
tradeWindowOne->SetTempVar( CITV_MOREZ, tSock->GetByte( 11 ));
|
|
SendTradeStatus( tradeWindowOne, tradeWindowTwo );
|
|
if( tradeWindowOne->GetTempVar( CITV_MOREZ ) && tradeWindowTwo->GetTempVar( CITV_MOREZ ))
|
|
{
|
|
CompleteTrade( tradeWindowOne, tradeWindowTwo, true );
|
|
}
|
|
}
|
|
break;
|
|
case 1: // Cancel trade. Send each person cancel messages, move items.
|
|
CancelTrade( tradeWindowOne );
|
|
break;
|
|
default:
|
|
Console.Error( " Fallout of switch statement without default. trade.cpp, trademsg()" );
|
|
break;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
bool KillTradesFunctor( CBaseObject *a, UI32 &b, void *extraData )
|
|
{
|
|
bool retVal = true;
|
|
if( ValidateObject( a ) && a->CanBeObjType( OT_ITEM ))
|
|
{
|
|
// Body of the functor goes here
|
|
CItem *i = static_cast<CItem *>( a );
|
|
if( ValidateObject( i ))
|
|
{
|
|
if( i->GetType() == IT_TRADEWINDOW )
|
|
{
|
|
CChar *k = static_cast<CChar *>( i->GetCont() );
|
|
if( ValidateObject( k ))
|
|
{
|
|
CChar *mChar = static_cast<CChar *>( extraData );
|
|
if( k == mChar )
|
|
{
|
|
CancelTrade( i );
|
|
}
|
|
}
|
|
++b; // let's track how many we cleared
|
|
}
|
|
}
|
|
}
|
|
return retVal;
|
|
}
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Function - KillTrades()
|
|
//| Date - February 2, 2006
|
|
//o------------------------------------------------------------------------------------------------o
|
|
//| Purpose - Cancels any active trades associated with a character.
|
|
//o------------------------------------------------------------------------------------------------o
|
|
void KillTrades( CChar *i )
|
|
{
|
|
UI32 b = 0;
|
|
ObjectFactory::GetSingleton().IterateOver( OT_ITEM, b, i, &KillTradesFunctor );
|
|
}
|