mirror of
https://github.com/UOX3DevTeam/UOX3
synced 2026-08-13 12:27:04 -04:00
Updated Item DFNs with ORIGIN and SECTIONID tags for relevant items Added JS Function to make comparing eras (based on object origin or server settings) easier: EraStringToNum( eraString ) // Takes an era string (uo, t2a, uor, td, lbr, aos, etc) and returns an int Updated some JS scripts to use EraStringToNum() for era comparisons (potionkeg.js) Default CORESHARDERA setting is now LBR Removed PUB15 as a separate "era" - it's identical to late stage LBR anyway: Removed support for GETPUB15 tag Added support for GETUO tag for items/NPCs: GETUO=<sectionID> // Inherit DFN section if core shard era is Ultima Online (original release, before T2A) Rewrote portions of MsgBoardQuestEscortCreate() function in msgboard.cpp to ensure only escort regions within same world as NPC can be selected as destinations Increased maximum number of possible escort regions that can exist from 255 to 65535 Added region definitions for all shrines in Britannia (Fel & Trammel), and marked them as valid destinations for NPC escorts (uox3/regions/regions.dfn) Moved bankers from vendor to human DFN files, and made them inherit basehuman instead of basevendor - since they are not vendors To address an issue with escorted NPCs not timing out and vanishing if they are left in a "dormant" area of the world with no player activity, the NPCs are marked as "always awake" the moment they arrive at their destination. Note that the uox.ini setting ALLOWAWAKENPCS needs to be enabled for this to work. Fixed an issue where spawnsection of spawners did not show up correctly in tweak menu Fixed an issue where the generic Orc AI script didn't have a return true at end of onDamage() event, which prevented all orcs from taking damage in combat (js/npc/ai/monster/orc.js) Moved Anatomy skill-check in healing script (js/skill/healing.js) from onCallback1() function to onTimer() to prevent the skill-check from being spammable Added mount ID for Frost Mite in creatures.dfn, allowing it to be used as mount Exposed the following character properties to JS engine, which can be used to view/adjust the permanent hair/beard options for a character: .hairStyle .hairColour .beardStyle .beardColour Updated 'kill hair, 'shavehair, 'shavebeard and 'remove commands to clear permanent hair/beard colour and style properties in addition to removing the item itself Added a GM override to let GMs place as many houses as they want (js/server/house/houseDeed.js) Fixed an issue where attempting to sell items to NPC shopkeepers could result in client crashing Added a new JS Event: onMultiLogout( iMulti, cPlayer ) // Handles players logging out while inside multis Updated house script (js/server/house/house.js) with onMultiLogout event, which allows owners (always) and co-owners/friends/guests (if option enabled in uox.ini) to safely log out inside the house (without getting booted). Added a "keyless" option for interacting with locked doors (js/item/doors.js) of player-owned houses, which lets owners/co-owners/friends/guests of a house use locked doors in the house without requiring a key in their backpack, if the options for that are enabled in UOX.INI. Enabled for owners/co-owners and friends by default (but not for guests) Note that if option to safely log out is enabled, but keyless option is NOT enabled, then the server will check if the player has a key to the house in their backpack, and eject them from the house upon logging out if not. This is to make sure players don't get stuck inside a house they can't get out of because they lack the rights to open doors etc. Added new UOX.INI options, under the [houses] section: SAFECOOWNERLOGOUT=1 // Allow co-owners to safely and instantly log out inside house SAFEFRIENDLOGOUT=1 // Allow friends to safely and instantly log out inside house SAFEGUESTLOGOUT=1 // Allow guests to safely and instantly log out inside house KEYLESSOWNERACCESS=1 // Allow owner of house to use locked doors in house without key in pack KEYLESSCOOWNERACCESS=1 // Allow co-owners of house to use locked doors in house without key in pack KEYLESSFRIENDACCESS=1 // Allow friends of house to use locked doors in house without key in pack KEYLESSGUESTACCESS=0 // Allow guests of house to use locked doors in house without key in pack Fixed NOHAIR tag from races.dfn not being loaded correctly
296 lines
11 KiB
C++
296 lines
11 KiB
C++
#ifndef __CSCRIPT_H__
|
|
#define __CSCRIPT_H__
|
|
|
|
|
|
class CPIGumpMenuSelect;
|
|
class CPIGumpInput;
|
|
|
|
enum ScriptEvent
|
|
{
|
|
seOnCreateDFN = 0, // * Done for PCs on global script
|
|
seOnCreateTile,
|
|
seOnCommand,
|
|
seOnDelete, // **
|
|
seOnSpeech, // * Missing item response at the moment
|
|
seInRange, // * Missing character in range
|
|
seOnCollide, // ** Items only
|
|
seOnMoveDetect, // ***
|
|
seOnSteal, // **
|
|
seOnDispel, // **
|
|
seOnSkill,
|
|
seOnStat,
|
|
seOnTooltip,
|
|
seOnNameRequest,
|
|
seOnAttack,
|
|
seOnDefense,
|
|
seOnSkillGain, // **
|
|
seOnSkillLoss, // **
|
|
seOnSkillChange, // **
|
|
seOnStatGained, // **
|
|
seOnStatGain, // **
|
|
seOnStatLoss, // **
|
|
seOnStatChange, // **
|
|
seOnDrop,
|
|
seOnPickup,
|
|
seOnContRemoveItem,
|
|
seOnSwing,
|
|
seOnDecay,
|
|
seOnTransfer,
|
|
seOnEntrance, // **
|
|
seOnLeaving, // **
|
|
seOnMultiLogout, // **
|
|
seOnEquipAttempt, // **
|
|
seOnEquip, // **
|
|
seOnUnequipAttempt, // **
|
|
seOnUnequip, // **
|
|
seOnUseChecked, // ** the event that replaces hardcoded use-stuff
|
|
seOnUseUnChecked,
|
|
seOutOfRange, // * Missing character out of range
|
|
seOnLogin, // **
|
|
seOnLogout,
|
|
seOnClick,
|
|
seOnFall,
|
|
seOnSell,
|
|
seOnSellToVendor,
|
|
seOnBuy,
|
|
seOnBuyFromVendor,
|
|
seOnSoldToVendor,
|
|
seOnBoughtFromVendor,
|
|
seOnAISliver, // **
|
|
seOnSystemSlice,
|
|
seOnUnknownTrigger,
|
|
seOnLightChange,
|
|
seOnWeatherChange,
|
|
seOnTempChange,
|
|
seOnTimer, // **
|
|
seOnDeath, // **
|
|
seOnResurrect, // **
|
|
seOnFlagChange, // **
|
|
seOnLoyaltyChange, // **
|
|
seOnHungerChange, // **
|
|
seOnThirstChange, // **
|
|
seOnStolenFrom, // **
|
|
seOnSnooped, // **
|
|
seOnSnoopAttempt, // **
|
|
seOnEnterRegion, // **
|
|
seOnLeaveRegion, // **
|
|
seOnSpellTarget,
|
|
seOnSpellCast,
|
|
seOnSpellSuccess,
|
|
seOnTalk,
|
|
seOnScrollCast,
|
|
seOnSpeechInput,
|
|
seOnSpellGain,
|
|
seOnSpellLoss,
|
|
seOnSkillCheck,
|
|
seOnDropItemOnNpc,
|
|
seOnStart,
|
|
seOnStop,
|
|
seOnIterate,
|
|
seOnIterateSpawnRegions,
|
|
seOnPacketReceive,
|
|
seOnCharDoubleClick, // ** the event that replaces hardcoded character doubleclick-stuff
|
|
seOnSkillGump, // ** allows overriding client's request to open default skill gump
|
|
seOnCombatStart, // ** allows overriding what happens when combat is initiated
|
|
seOnAICombatTarget, // ** allows overriding target selection taking place for regular AI behaviours
|
|
seOnCombatEnd, // ** allows overriding what happens when combat ends
|
|
seOnDeathBlow,
|
|
seOnCombatDamageCalc,
|
|
seOnDamage,
|
|
seOnGumpPress,
|
|
seOnGumpInput,
|
|
seOnScrollingGumpPress,
|
|
seOnDropItemOnItem,
|
|
seOnVirtueGumpPress,
|
|
seOnUseBandageMacro, // ** allows overriding what happens when client uses bandage macros
|
|
seOnHouseCommand, // ** allows overriding what happens when player speaks house commands
|
|
seOnMakeItem,
|
|
seOnPathfindEnd,
|
|
seOnEnterEvadeState,
|
|
seOnCarveCorpse,
|
|
seOnDyeTarget,
|
|
seOnQuestGump,
|
|
seOnHelpButton,
|
|
seOnWarModeToggle,
|
|
seOnSpecialMove,
|
|
seOnFacetChange
|
|
};
|
|
|
|
struct SEGump_st
|
|
{
|
|
std::vector<std::string> *one, *two;
|
|
UI32 textId;
|
|
};
|
|
|
|
struct SEGumpData_st
|
|
{
|
|
std::vector<std::string> sEdits;
|
|
std::vector<SI32> nButtons;
|
|
std::vector<SI16> nIDs;
|
|
};
|
|
|
|
class cScript
|
|
{
|
|
private:
|
|
|
|
JSScript * targScript;
|
|
JSContext * targContext;
|
|
JSObject * targObject;
|
|
|
|
bool isFiring;
|
|
UI08 runTime;
|
|
|
|
std::bitset<64> eventPresence[3];
|
|
std::bitset<64> needsChecking[3];
|
|
bool EventExists( ScriptEvent eventNum ) const;
|
|
bool NeedsChecking( ScriptEvent eventNum ) const;
|
|
void SetEventExists( ScriptEvent eventNum, bool status );
|
|
void SetNeedsChecking( ScriptEvent eventNum, bool status );
|
|
bool ExistAndVerify( ScriptEvent eventNum, std::string functionName );
|
|
|
|
std::vector<SEGump_st *> gumpDisplays;
|
|
|
|
void Cleanup( void );
|
|
|
|
public:
|
|
void CollectGarbage( void );
|
|
|
|
size_t NewGumpList( void );
|
|
SEGump_st * GetGumpList( SI32 index );
|
|
void RemoveGumpList( SI32 index );
|
|
void SendGumpList( SI32 index, CSocket *toSendTo );
|
|
|
|
void HandleGumpPress( CPIGumpMenuSelect *packet );
|
|
void HandleGumpInput( CPIGumpInput *pressing );
|
|
|
|
cScript( std::string targFile, UI08 runTime );
|
|
~cScript();
|
|
|
|
JSObject * Object( void ) const; // returns object pointer
|
|
|
|
|
|
//| Modification - 08162003 - Added these event to handle any script initialization and clean up as the server starts, and is shut down
|
|
bool OnStart( void );
|
|
bool OnStop( void );
|
|
//
|
|
bool OnPacketReceive( CSocket *mSock, UI16 packetNum );
|
|
bool OnIterate( CBaseObject *a, UI32 &b );
|
|
bool OnIterateSpawnRegions( CSpawnRegion *a, UI32 &b );
|
|
bool OnCreate( CBaseObject *thingCreated, bool dfnCreated );
|
|
SI08 OnCommand( CSocket *mSock, std::string command );
|
|
bool OnDelete( CBaseObject *thingDestroyed );
|
|
SI08 OnSpeech( const char *speech, CChar *personTalking, CBaseObject *talkingTo );
|
|
bool InRange( CBaseObject *srcObj, CBaseObject *objInRange );
|
|
SI08 OnCollide( CSocket *targSock, CChar *objColliding, CBaseObject *objCollideWith );
|
|
SI08 OnMoveDetect( CBaseObject *sourceObj, CChar *CharInRange, UI08 rangeToChar, UI16 oldCharX, UI16 oldCharY );
|
|
SI08 OnSteal( CChar *thief, CItem *theft, CChar *victim );
|
|
SI08 OnPathfindEnd( CChar *npc, SI08 pathfindResult );
|
|
SI08 OnEnterEvadeState( CChar *npc, CChar *enemy );
|
|
SI08 OnCarveCorpse( CChar *player, CItem *corpse );
|
|
SI08 OnDyeTarget( CChar *player, CItem *dyeTub, CItem *target );
|
|
SI08 OnDispel( CBaseObject *dispelled );
|
|
bool OnSkill( CBaseObject *skillUse, SI08 skillUsed );
|
|
bool OnStat( void );
|
|
std::string OnTooltip( CBaseObject *myObj, CSocket *pSocket );
|
|
std::string OnNameRequest( CBaseObject *myObj, CChar *nameRequester );
|
|
bool OnAttack( CChar *attacker, CChar *defender );
|
|
bool OnDefense( CChar *attacker, CChar *defender );
|
|
SI08 OnSkillGain( CChar *player, SI08 skill, UI32 skillAmtGained );
|
|
SI08 OnSkillLoss( CChar *player, SI08 skill, UI32 skillAmtLost );
|
|
bool OnSkillChange( CChar *player, SI08 skill, SI32 skillAmtChanged );
|
|
SI08 OnStatGained( CChar *player, UI32 stat, SI08 skill, UI32 statGainedAmount );
|
|
bool OnStatGain( CChar *player, UI32 stat, SI08 skill, UI32 statGainAmount );
|
|
SI08 OnStatLoss( CChar *player, UI32 stat, UI32 statLossAmount );
|
|
bool OnStatChange( CChar *player, UI32 stat, SI32 statChangeAmount );
|
|
SI08 OnDrop( CItem *item, CChar *dropper );
|
|
SI08 OnPickup( CItem *item, CChar *pickerUpper );
|
|
bool OnContRemoveItem( CItem *contItem, CItem *item, CChar *pickerUpper );
|
|
SI08 OnSwing( CItem *swinging, CChar *swinger, CChar *swingTarg );
|
|
SI08 OnDecay( CItem *decaying );
|
|
SI08 OnEntrance( CMultiObj *left, CBaseObject *leaving );
|
|
SI08 OnLeaving( CMultiObj *left, CBaseObject *leaving );
|
|
SI08 OnMultiLogout( CMultiObj* iMulti, CChar* cPlayer );
|
|
SI08 OnEquipAttempt( CChar *equipper, CItem *equipping );
|
|
SI08 OnEquip( CChar *equipper, CItem *equipping );
|
|
SI08 OnUnequipAttempt( CChar *equipper, CItem *equipping );
|
|
SI08 OnUnequip( CChar *equipper, CItem *equipping );
|
|
SI08 OnUseChecked( CChar *user, CItem *iUsing );
|
|
SI08 OnUseUnChecked( CChar *user, CItem *iUsing );
|
|
bool OutOfRange( CBaseObject *srcObj, CBaseObject *objVanish );
|
|
bool OnLogin( CSocket *sockPlayer, CChar *pPlayer );
|
|
bool OnLogout( CSocket *sockPlayer, CChar *pPlayer );
|
|
SI08 OnClick( CSocket *sockPlayer, CBaseObject *objClicked );
|
|
bool OnFall( CChar *pFall, SI08 fallDistance );
|
|
SI08 OnAISliver( CChar *pSliver );
|
|
bool OnSystemSlice( void );
|
|
SI08 OnLightChange( CBaseObject *tObject, UI08 lightLevel );
|
|
bool OnWeatherChange( CBaseObject *tObject, WeatherType element );
|
|
bool OnTempChange( CBaseObject *tObject, SI08 temp );
|
|
bool OnTimer( CBaseObject *tObject, UI16 timerId );
|
|
SI08 OnDeath( CChar *pDead, CItem *iCorpse );
|
|
SI08 OnResurrect( CChar *pAlive );
|
|
SI08 OnFlagChange( CChar *pChanging, UI08 newStatus, UI08 oldStatus );
|
|
SI08 OnLoyaltyChange( CChar *pChanging, SI08 newStatus );
|
|
SI08 OnHungerChange( CChar *pChanging, SI08 newStatus );
|
|
bool OnThirstChange( CChar* pChanging, SI08 newStatus );
|
|
SI08 OnStolenFrom( CChar *stealing, CChar *stolenFrom, CItem *stolen );
|
|
SI08 OnSnooped( CChar *snooped, CChar *snooper, bool success );
|
|
SI08 OnSnoopAttempt( CChar *snooped, CChar *snooper );
|
|
bool OnEnterRegion( CChar *entering, UI16 region );
|
|
bool OnLeaveRegion( CChar *entering, UI16 region );
|
|
SI08 OnSpellTarget( CBaseObject *target, CChar *caster, UI08 spellNum );
|
|
bool DoCallback( CSocket *tSock, SERIAL targeted, UI08 callNum );
|
|
SI16 OnSpellCast( CChar *tChar, UI08 SpellId );
|
|
SI16 OnScrollCast( CChar *tChar, UI08 SpellId );
|
|
SI08 OnSpellSuccess( CChar *tChar, UI08 SpellId );
|
|
SI08 OnTalk( CChar *myChar, const char *mySpeech );
|
|
bool OnSpeechInput( CChar *myChar, CItem *myItem, const char *mySpeech );
|
|
SI08 OnSpellGain( CItem *book, const UI08 spellNum );
|
|
SI08 OnSpellLoss( CItem *book, const UI08 spellNum );
|
|
SI08 OnSkillCheck( CChar *myChar, const UI08 skill, const UI16 lowSkill, const UI16 highSkill, bool isCraftSkill );
|
|
SI08 OnDropItemOnNpc( CChar *srcChar, CChar *targChar, CItem *i );
|
|
SI08 OnDropItemOnItem( CItem *item, CChar *dropper, CItem *dest );
|
|
SI08 OnVirtueGumpPress( CChar *mChar, CChar *tChar, UI16 buttonId );
|
|
SI08 OnScrollingGumpPress( CSocket *tSock, UI16 gumpId, UI16 buttonId );
|
|
SI08 OnQuestGump( CChar *mChar );
|
|
SI08 OnHelpButton( CChar *mChar );
|
|
SI08 OnWarModeToggle( CChar *mChar );
|
|
SI08 OnSpecialMove( CChar *mChar, UI08 abilityId );
|
|
SI08 OnFacetChange( CChar *mChar, const UI08 oldFacet, const UI08 newFacet );
|
|
|
|
bool AreaObjFunc( char *funcName, CBaseObject *srcObject, CBaseObject *tmpObject, CSocket *s );
|
|
bool CallParticularEvent( const char *eventToCall, jsval *params, SI32 numParams, jsval *eventRetVal );
|
|
|
|
bool ScriptRegistration( std::string scriptType );
|
|
|
|
bool executeCommand( CSocket *s, std::string funcName, std::string executedString );
|
|
|
|
bool MagicSpellCast( CSocket *mSock, CChar *tChar, bool directCast, SI32 spellNum );
|
|
SI08 OnCharDoubleClick( CChar *currChar, CChar *targChar );
|
|
SI08 OnSkillGump( CChar *mChar );
|
|
SI08 OnUseBandageMacro( CSocket *mSock, CChar *targChar, CItem *bandageItem );
|
|
SI08 OnAICombatTarget( CChar *attacker, CChar *target );
|
|
SI08 OnCombatStart( CChar *attacker, CChar *defender );
|
|
SI08 OnCombatEnd( CChar *attacker, CChar *defender );
|
|
|
|
SI08 OnDeathBlow( CChar *mKilled, CChar *mKiller );
|
|
|
|
SI16 OnCombatDamageCalc( CChar *attacker, CChar *defender, UI08 getFightSkill, UI08 hitLoc );
|
|
SI08 OnDamage( CChar *damaged, CChar *attacker, SI16 damageValue, WeatherType damageType );
|
|
SI08 OnBuy( CSocket *targSock, CChar *objVendor );
|
|
SI08 OnBuyFromVendor( CSocket *targSock, CChar *objVendor, CBaseObject *objItemBought );
|
|
SI08 OnSellToVendor( CSocket *targSock, CChar *objVendor, CBaseObject *objItemSold );
|
|
SI08 OnSell( CSocket *targSock, CChar *objVendor );
|
|
SI08 OnBoughtFromVendor( CSocket *targSock, CChar *objVendor, CBaseObject *objItemBought );
|
|
SI08 OnSoldToVendor( CSocket *targSock, CChar *objVendor, CBaseObject *objItemSold );
|
|
SI08 OnHouseCommand( CSocket *targSock, CMultiObj *multiObj, UI08 targId );
|
|
SI08 OnMakeItem( CSocket *mSock, CChar *objChar, CItem *objItem, UI16 createEntryId );
|
|
|
|
// Critical handler type stuff
|
|
bool IsFiring( void );
|
|
void Firing( void );
|
|
void Stop( void );
|
|
};
|
|
|
|
#endif
|
|
|