Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event definitions in Sphere.ini have been made more extensive. #1323

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3985,3 +3985,43 @@ Added: 'H' shortcut for variables to get the value as hexadecimal.
TALKMODE_SPELL = 10 // Used by spells
TALKMODE_GUILD = 13 // Used by guild chat (client shortcut: \)
TALKMODE_ALLIANCE = 14 // Used by alliance chat (client shortcut: shift+\)

20-12-2024, canerksk
[Sphere.ini]
- Removed: (Action require by admin and must update this)
EventsPet=e_npc_generic_event
EventsPlayer=e_player_generic_event
- Added: Event definitions have been made more extensive.
// Events related to all NPCs
EventsNPC=e_npc_all

// Events related to all animals (brain_animal without mountables)
EventsNPCAnimal=e_npc_animals

// Events related to all monsters (brain_monster, brain_dragon, brain_berserk)
EventsNPCMonster=e_npc_monsters

// Events related to all animals (brain_animal with mountable)
EventsNPCMountable=e_npc_mountables

// Events related to all shopkeepers (brain_vendor, brain_stable, brain_healer)
EventsNPCShop=e_npc_shopkeepers

// Events related to all clients (player and staff)
EventsClient=e_client_all

// Events related to all staff (if plevel is higher than 1)
EventsClientStaff=e_client_staffs

// Events related to all players (if the plevel is lower than 1)
EventsClientPlayer=e_client_players

// Events related to all regions
//EventsRegion=e_region_all

// Events related to all items
EventsItem=ei_items

// Events related to all weapons
EventsItemWeapon=ei_item_weapons

119 changes: 99 additions & 20 deletions src/game/CServerConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,16 @@ enum RC_TYPE
RC_ERALIMITGEAR, // _iEraLimitGear
RC_ERALIMITLOOT, // _iEraLimitLoot
RC_ERALIMITPROPS, // _iEraLimitProps
RC_EVENTSITEM, // m_sEventsItem
RC_EVENTSPET, // m_sEventsPet
RC_EVENTSPLAYER, // m_sEventsPlayer
RC_EVENTSCLIENT, // m_sEventsClient
RC_EVENTSCLIENTPLAYER, // m_sEventsClientPlayer
RC_EVENTSCLIENTSTAFF, // m_sEventsClientStaff
RC_EVENTSITEM, // m_sEventsItem
RC_EVENTSITEMWEAPON, // m_sEventsItemWeapon
RC_EVENTSNPC, // m_sEventsNpc
RC_EVENTSNPCANIMAL, // m_sEventsNpcAnimal
RC_EVENTSNPCMONSTER, // m_sEventsNPCMonster
RC_EVENTSNPCMOUNTABLE, // m_sEventsNPCMountable
RC_EVENTSNPCSHOP, // m_sEventsNPCShop
RC_EVENTSREGION, // m_sEventsRegion
RC_EXPERIENCEKOEFPVM, // m_iExperienceKoefPVM
RC_EXPERIENCEKOEFPVP, // m_iExperienceKoefPVP
Expand Down Expand Up @@ -842,9 +849,16 @@ const CAssocReg CServerConfig::sm_szLoadKeys[RC_QTY + 1]
{ "ERALIMITGEAR", { ELEM_BYTE, static_cast<uint>OFFSETOF(CServerConfig,_iEraLimitGear) }},
{ "ERALIMITLOOT", { ELEM_BYTE, static_cast<uint>OFFSETOF(CServerConfig,_iEraLimitLoot) }},
{ "ERALIMITPROPS", { ELEM_BYTE, static_cast<uint>OFFSETOF(CServerConfig,_iEraLimitProps) }},
{ "EVENTSCLIENT", { ELEM_CSTRING, static_cast<uint> OFFSETOF(CServerConfig, m_sEventsClient) } },
{ "EVENTSCLIENTPLAYER", { ELEM_CSTRING, static_cast<uint> OFFSETOF(CServerConfig, m_sEventsClientPlayer) } },
{ "EVENTSCLIENTSTAFF", { ELEM_CSTRING, static_cast<uint> OFFSETOF(CServerConfig, m_sEventsClientStaff) } },
{ "EVENTSITEM", { ELEM_CSTRING, static_cast<uint>OFFSETOF(CServerConfig,m_sEventsItem) }},
{ "EVENTSPET", { ELEM_CSTRING, static_cast<uint>OFFSETOF(CServerConfig,m_sEventsPet) }},
{ "EVENTSPLAYER", { ELEM_CSTRING, static_cast<uint>OFFSETOF(CServerConfig,m_sEventsPlayer) }},
{ "EVENTSITEMWEAPON", { ELEM_CSTRING, static_cast<uint> OFFSETOF(CServerConfig, m_sEventsItemWeapon) } },
{ "EVENTSNPC", { ELEM_CSTRING, static_cast<uint> OFFSETOF(CServerConfig, m_sEventsNPC) } },
{ "EVENTSNPCANIMAL", { ELEM_CSTRING, static_cast<uint> OFFSETOF(CServerConfig, m_sEventsNPCAnimal) } },
{ "EVENTSNPCMONSTER", { ELEM_CSTRING, static_cast<uint> OFFSETOF(CServerConfig, m_sEventsNPCMonster) } },
{ "EVENTSNPCMOUNTABLE", { ELEM_CSTRING, static_cast<uint> OFFSETOF(CServerConfig, m_sEventsNPCMountable) } },
{ "EVENTSNPCSHOP", { ELEM_CSTRING, static_cast<uint> OFFSETOF(CServerConfig, m_sEventsNPCShop) } },
{ "EVENTSREGION", { ELEM_CSTRING, static_cast<uint>OFFSETOF(CServerConfig,m_sEventsRegion) }},
{ "EXPERIENCEKOEFPVM", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,m_iExperienceKoefPVM) }},
{ "EXPERIENCEKOEFPVP", { ELEM_INT, static_cast<uint>OFFSETOF(CServerConfig,m_iExperienceKoefPVP) }},
Expand Down Expand Up @@ -4818,29 +4832,94 @@ bool CServerConfig::Load( bool fResync )
pRegion->MakeRegionDefname();
}

// parse eventsitem
/////////////////////
// parse eventsitem
/////////////////////
// all items
m_iEventsItemLink.clear();
if ( ! m_sEventsItem.IsEmpty() )
{
CScript script("EVENTSITEM", m_sEventsItem);
m_iEventsItemLink.r_LoadVal(script, RES_EVENTS);
}

// parse eventspet
m_pEventsPetLink.clear();
if ( ! m_sEventsPet.IsEmpty() )
{
CScript script("EVENTSPET", m_sEventsPet);
m_pEventsPetLink.r_LoadVal(script, RES_EVENTS);
}
// all weapons
m_iEventsItemWeaponLink.clear();
if (!m_sEventsItemWeapon.IsEmpty())
{
CScript script("EVENTSITEMWEAPON", m_sEventsItemWeapon);
m_iEventsItemWeaponLink.r_LoadVal(script, RES_EVENTS);
}

// parse eventsplayer
m_pEventsPlayerLink.clear();
if ( ! m_sEventsPlayer.IsEmpty() )
{
CScript script("EVENTSPLAYER", m_sEventsPlayer);
m_pEventsPlayerLink.r_LoadVal(script, RES_EVENTS);
}
/////////////////////
// parse eventsnpc
/////////////////////
// all npcs
m_pEventsNPCLink.clear();
if (!m_sEventsNPC.IsEmpty())
{
CScript script("EVENTSNPC", m_sEventsNPC);
m_pEventsNPCLink.r_LoadVal(script, RES_EVENTS);
}

// all animals
m_pEventsNPCAnimalLink.clear();
if (!m_sEventsNPCAnimal.IsEmpty())
{
CScript script("EVENTSNPCANIMAL", m_sEventsNPCAnimal);
m_pEventsNPCAnimalLink.r_LoadVal(script, RES_EVENTS);
}
// all monsters
m_pEventsNPCMonsterLink.clear();
if (!m_sEventsNPCMonster.IsEmpty())
{
CScript script("EVENTSNPCMONSTER", m_sEventsNPCMonster);
m_pEventsNPCMonsterLink.r_LoadVal(script, RES_EVENTS);
}

// all mountables
m_pEventsNPCMountableLink.clear();
if (!m_sEventsNPCMountable.IsEmpty())
{
CScript script("EVENTSNPCMOUNTABLE", m_sEventsNPCMountable);
m_pEventsNPCMountableLink.r_LoadVal(script, RES_EVENTS);
}

// all shopkeepers
m_pEventsNPCShopLink.clear();
if (!m_sEventsNPCShop.IsEmpty())
{
CScript script("EVENTSNPCSHOP", m_sEventsNPCShop);
m_pEventsNPCShopLink.r_LoadVal(script, RES_EVENTS);
}

/////////////////////
// parse eventsClient
/////////////////////

// allClient (players or staffs)
m_pEventsClientLink.clear();
if (!m_sEventsClient.IsEmpty())
{
CScript script("EVENTSCLIENT", m_sEventsClient);
m_pEventsClientLink.r_LoadVal(script, RES_EVENTS);
}

// all players
m_pEventsClientPlayerLink.clear();
if (!m_sEventsClientPlayer.IsEmpty())
{
CScript script("EVENTSCLIENTPLAYER", m_sEventsClientPlayer);
m_pEventsClientPlayerLink.r_LoadVal(script, RES_EVENTS);
}

// all staffs
m_pEventsClientStaffLink.clear();
if (!m_sEventsClientStaff.IsEmpty())
{
CScript script("EVENTSCLIENTSTAFF", m_sEventsClientStaff);
m_pEventsClientStaffLink.r_LoadVal(script, RES_EVENTS);
}

// parse eventsregion
m_pEventsRegionLink.clear();
Expand Down
65 changes: 54 additions & 11 deletions src/game/CServerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,60 @@ extern class CServerConfig : public CResourceHolder
CSString m_sDumpAccPackets;
#endif

CSString m_sEventsPet; // Key to add Events to all pets.
CResourceRefArray m_pEventsPetLink; // EventsPet.

CSString m_sEventsPlayer; // Key to add Events to all players.
CResourceRefArray m_pEventsPlayerLink; // EventsPlayer.

CSString m_sEventsRegion; // Key to add Events to all regions.
CResourceRefArray m_pEventsRegionLink; // EventsRegion.

CSString m_sEventsItem; // Key to add Events to all items.
CResourceRefArray m_iEventsItemLink; // EventsItem.

//////////////////////
// Npcs
//////////////////////
// EVENTSNPC
CSString m_sEventsNPC; // Key to add Events to all npc.
CResourceRefArray m_pEventsNPCLink; // m_sEventsNPC.

// EVENTSNPCANIMAL
CSString m_sEventsNPCAnimal; // Key to add Events to all animals
CResourceRefArray m_pEventsNPCAnimalLink; // m_sEventsNPCAnimal.

// EVENTSNPCMONSTER
CSString m_sEventsNPCMonster; // Key to add Events to all monsters (brain_monster, brain_dragon, brain_berserk).
CResourceRefArray m_pEventsNPCMonsterLink; // m_sEventsNPCMonster.

// EVENTSNPCMOUNTABLE
CSString m_sEventsNPCMountable; // Key to add Events to all mountables (brain_animal).
CResourceRefArray m_pEventsNPCMountableLink; // EventsNPCMountable.

// EVENTSNPCSHOP
CSString m_sEventsNPCShop; // Key to add Events to all shopkeepers (brain_vendor).
CResourceRefArray m_pEventsNPCShopLink; // EventsNPCShop.

//////////////////////
// Clients
//////////////////////
// EVENTSCLIENT
CSString m_sEventsClient; // Key to add Events to all players and staff.
CResourceRefArray m_pEventsClientLink; // EventsClient.

// EVENTSCLIENTSTAFF
CSString m_sEventsClientStaff; // Key to add Events to all players.
CResourceRefArray m_pEventsClientStaffLink; // EventsClientStaff.

// EVENTSCLIENTPLAYER
CSString m_sEventsClientPlayer; // Key to add Events to all players.
CResourceRefArray m_pEventsClientPlayerLink; // EventsClientPlayer.

//////////////////////
// Regions
//////////////////////
CSString m_sEventsRegion; // Key to add Events to all regions.
CResourceRefArray m_pEventsRegionLink; // EventsRegion.

//////////////////////
// Items
//////////////////////
CSString m_sEventsItem; // Key to add Events to all items.
CResourceRefArray m_iEventsItemLink; // EventsItem.

// Weapon
CSString m_sEventsItemWeapon; // Key to add Events to all items.
CResourceRefArray m_iEventsItemWeaponLink; //EventsItemWeapon.

// Third Party Tools
CSString m_sStripPath; // Strip Path for TNG and Axis.
Expand Down
Loading