From 2c91caa1dd4ea53dfeb63751d04170d9a9a61474 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Wed, 4 Jun 2025 12:02:51 -0300 Subject: finish most spells --- reference/game.c | 320 +------------------------------------------------------ src/creature.hh | 1 + src/magic.cc | 220 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 222 insertions(+), 319 deletions(-) diff --git a/reference/game.c b/reference/game.c index 15b71f3..0a5f3af 100644 --- a/reference/game.c +++ b/reference/game.c @@ -20852,325 +20852,7 @@ void __static_initialization_and_destruction_0(int __initialize_p,int __priority return; } -void BanishAccount(TCreature *cr,char *Name,int param_3,char *Reason) - -{ - undefined4 *puVar1; - char *Text; - - if (cr == (TCreature *)0x0) { - Text = &DAT_080fcf40; - } - else if (Name == (char *)0x0) { - Text = &DAT_080fcf00; - } - else if (Reason == (char *)0x0) { - Text = &DAT_080fcec0; - } - else { - if (cr->Type == PLAYER) { - // try { // try from 08087d22 to 08087d60 has its CatchHandler @ 08087d80 - SendMessage(cr->Connection,0x17, - "Spell is not available any more. Press Ctrl+Y for the dialog."); - return; - } - Text = "BanishAccount: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(Text); - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = 0xffffffff; - // WARNING: Subroutine does not return - __cxa_throw(puVar1,&RESULT::typeinfo,0); -} - - - -void DeleteAccount(TCreature *cr,char *Name,char *Reason) - -{ - undefined4 *puVar1; - char *Text; - - if (cr == (TCreature *)0x0) { - Text = &DAT_080fd060; - } - else if (Name == (char *)0x0) { - Text = &DAT_080fd020; - } - else if (Reason == (char *)0x0) { - Text = &DAT_080fcfe0; - } - else { - if (cr->Type == PLAYER) { - // try { // try from 08087de2 to 08087e20 has its CatchHandler @ 08087e40 - SendMessage(cr->Connection,0x17, - "Spell is not available any more. Press Ctrl+Y for the dialog."); - return; - } - Text = "DeleteAccount: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(Text); - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = 0xffffffff; - // WARNING: Subroutine does not return - __cxa_throw(puVar1,&RESULT::typeinfo,0); -} - - - -void BanishCharacter(TCreature *cr,char *Name,int param_3,char *Reason) - -{ - undefined4 *puVar1; - char *Text; - - if (cr == (TCreature *)0x0) { - Text = &DAT_080fd180; - } - else if (Name == (char *)0x0) { - Text = &DAT_080fd140; - } - else if (Reason == (char *)0x0) { - Text = &DAT_080fd100; - } - else { - if (cr->Type == PLAYER) { - // try { // try from 08087ea2 to 08087ee0 has its CatchHandler @ 08087f00 - SendMessage(cr->Connection,0x17, - "Spell is not available any more. Press Ctrl+Y for the dialog."); - return; - } - Text = "BanishCharacter: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(Text); - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = 0xffffffff; - // WARNING: Subroutine does not return - __cxa_throw(puVar1,&RESULT::typeinfo,0); -} - - - -void DeleteCharacter(TCreature *cr,char *Name,char *Reason) - -{ - undefined4 *puVar1; - char *Text; - - if (cr == (TCreature *)0x0) { - Text = &DAT_080fd2a0; - } - else if (Name == (char *)0x0) { - Text = &DAT_080fd260; - } - else if (Reason == (char *)0x0) { - Text = &DAT_080fd220; - } - else { - if (cr->Type == PLAYER) { - // try { // try from 08087f62 to 08087fa0 has its CatchHandler @ 08087fc0 - SendMessage(cr->Connection,0x17, - "Spell is not available any more. Press Ctrl+Y for the dialog."); - return; - } - Text = "DeleteCharacter: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(Text); - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = 0xffffffff; - // WARNING: Subroutine does not return - __cxa_throw(puVar1,&RESULT::typeinfo,0); -} - - - -void IPBanishment(TCreature *cr,char *Name,char *Reason) - -{ - undefined4 *puVar1; - char *Text; - - if (cr == (TCreature *)0x0) { - Text = &DAT_080fd3c0; - } - else if (Name == (char *)0x0) { - Text = &DAT_080fd380; - } - else if (Reason == (char *)0x0) { - Text = &DAT_080fd340; - } - else { - if (cr->Type == PLAYER) { - // try { // try from 08088022 to 08088060 has its CatchHandler @ 08088080 - SendMessage(cr->Connection,0x17, - "Spell is not available any more. Press Ctrl+Y for the dialog."); - return; - } - Text = "IPBanishment: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(Text); - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = 0xffffffff; - // WARNING: Subroutine does not return - __cxa_throw(puVar1,&RESULT::typeinfo,0); -} - - - -void SetNameRule(TCreature *cr,char *Name) - -{ - undefined4 *puVar1; - char *Text; - - if (cr == (TCreature *)0x0) { - Text = &DAT_080fd4e0; - } - else if (Name == (char *)0x0) { - Text = &DAT_080fd4a0; - } - else { - if (cr->Type == PLAYER) { - // try { // try from 080880d7 to 08088115 has its CatchHandler @ 08088128 - SendMessage(cr->Connection,0x17,"Spell is not available any more."); - return; - } - Text = "SetNameRule: Zauberspruch kann nur von Spieler angewendet werden.\n"; - } - error(Text); - puVar1 = (undefined4 *)__cxa_allocate_exception(4); - *puVar1 = 0xffffffff; - // WARNING: Subroutine does not return - __cxa_throw(puVar1,&RESULT::typeinfo,0); -} - - - -void KickPlayer(TCreature *cr,char *Name) - -{ - bool bVar1; - int Result; - int iVar2; - undefined4 *puVar3; - char *pcVar4; - TPlayer *local_20; - TPlayer *Opp; - - if (cr == (TCreature *)0x0) { - pcVar4 = &DAT_080fd600; - } - else if (Name == (char *)0x0) { - pcVar4 = &DAT_080fd5c0; - } - else { - if (cr->Type == PLAYER) { - // try { // try from 08088181 to 080882ae has its CatchHandler @ 080882d5 - bVar1 = CheckRight(cr->ID,KICK); - if (!bVar1) { - return; - } - bVar1 = CheckRight(cr->ID,READ_GAMEMASTER_CHANNEL); - iVar2 = IdentifyPlayer(Name,false,!bVar1,&local_20); - if (iVar2 == -1) { - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0x1b; - } - else { - if (iVar2 != -2) { - pcVar4 = (local_20->super_TCreature).Name; - Opp = (TPlayer *)(local_20->super_TCreature).CrObject.ObjectID; - GraphicalEffect((Object *)&Opp,0xf); - TCreature::StartLogout(&local_20->super_TCreature,true,true); - SendMessage(cr->Connection,0x16,"Player %s kicked out of the game.",pcVar4); - Log("banish","%s kickt %s.\n",cr->Name,pcVar4); - return; - } - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0x1c; - } - goto LAB_08088277; - } - pcVar4 = "KickPlayer: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(pcVar4); - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0xffffffff; -LAB_08088277: - // WARNING: Subroutine does not return - __cxa_throw(puVar3,&RESULT::typeinfo,0); -} - - - -void HomeTeleport(TCreature *cr,char *Name) - -{ - bool bVar1; - int Result; - int iVar2; - undefined4 *puVar3; - char *pcVar4; - TPlayer *local_60; - TPlayer *Opp; - Object local_4c [4]; - Object local_3c [4]; - TPlayer *local_2c; - Object Obj; - - if (cr == (TCreature *)0x0) { - pcVar4 = &DAT_080fd740; - } - else if ((Name == (char *)0x0) || (*Name == '\0')) { - pcVar4 = "HomeTeleport: Name existiert nicht.\n"; - } - else { - if (cr->Type == PLAYER) { - // try { // try from 08088340 to 080884dc has its CatchHandler @ 08088503 - bVar1 = CheckRight(cr->ID,HOME_TELEPORT); - if (!bVar1) { - return; - } - bVar1 = CheckRight(cr->ID,READ_GAMEMASTER_CHANNEL); - iVar2 = IdentifyPlayer(Name,false,!bVar1,&local_60); - if (iVar2 == -1) { - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0x1b; - } - else { - if (iVar2 != -2) { - pcVar4 = (local_60->super_TCreature).Name; - local_3c[0].ObjectID = (local_60->super_TCreature).CrObject.ObjectID; - local_2c = (TPlayer *)local_3c[0].ObjectID; - GraphicalEffect(local_3c,3); - local_3c[0].ObjectID = NONE.ObjectID; - GetMapContainer((int)local_4c,(local_60->super_TCreature).startx, - (local_60->super_TCreature).starty); - Opp = local_2c; - Move(0,(Object *)&Opp,local_4c,-1,false,local_3c); - Opp = local_2c; - GraphicalEffect((Object *)&Opp,0xd); - SendMessage(cr->Connection,0x16,"Player %s has been moved to the temple.",pcVar4 - ); - Log("banish","%s teleportiert %s zum Tempel.\n",cr->Name,pcVar4); - return; - } - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0x1c; - } - goto LAB_080884a5; - } - pcVar4 = "HomeTeleport: Zauberspruch kann nur von Spielern angewendet werden.\n"; - } - error(pcVar4); - puVar3 = (undefined4 *)__cxa_allocate_exception(4); - *puVar3 = 0xffffffff; -LAB_080884a5: - // WARNING: Subroutine does not return - __cxa_throw(puVar3,&RESULT::typeinfo,0); -} - - +// MAGIC.CC void SpellFailed(ulong CreatureID) diff --git a/src/creature.hh b/src/creature.hh index 96367ff..cfa0293 100644 --- a/src/creature.hh +++ b/src/creature.hh @@ -76,6 +76,7 @@ struct TCreature: TSkillBase { TCreature(void); void Attack(void); int Damage(TCreature *Attacker, int Damage, int DamageType); + void StartLogout(bool Force, bool StopFight); void BlockLogout(int Delay, bool BlockProtectionZone); void ToDoGo(int DestX, int DestY, int DestZ, bool Dest, int MaxSteps); diff --git a/src/magic.cc b/src/magic.cc index 87de8f1..3db1456 100644 --- a/src/magic.cc +++ b/src/magic.cc @@ -3007,6 +3007,226 @@ void NameLock(TCreature *Actor, const char *Name){ "Spell is not available any more. Press Ctrl+Y for the dialog."); } +void BanishAccount(TCreature *Actor, const char *Name, int Duration, const char *Reason){ + if(Actor == NULL){ + error("BanishAccount: Ungültige Kreatur übergeben.\n"); + throw ERROR; + } + + if(Name == NULL){ + error("BanishAccount: Ungültiger Name übergeben.\n"); + throw ERROR; + } + + if(Reason == NULL){ + error("BanishAccount: Ungültiger Grund übergeben.\n"); + throw ERROR; + } + + if(Actor->Type != PLAYER){ + error("BanishAccount: Zauberspruch kann nur von Spielern angewendet werden.\n"); + throw ERROR; + } + + SendMessage(Actor->Connection, TALK_FAILURE_MESSAGE, + "Spell is not available any more. Press Ctrl+Y for the dialog."); +} + +void DeleteAccount(TCreature *Actor, const char *Name, const char *Reason){ + if(Actor == NULL){ + error("DeleteAccount: Ungültige Kreatur übergeben.\n"); + throw ERROR; + } + + if(Name == NULL){ + error("DeleteAccount: Ungültiger Name übergeben.\n"); + throw ERROR; + } + + if(Reason == NULL){ + error("DeleteAccount: Ungültiger Grund übergeben.\n"); + throw ERROR; + } + + if(Actor->Type != PLAYER){ + error("DeleteAccount: Zauberspruch kann nur von Spielern angewendet werden.\n"); + throw ERROR; + } + + SendMessage(Actor->Connection, TALK_FAILURE_MESSAGE, + "Spell is not available any more. Press Ctrl+Y for the dialog."); +} + +void BanishCharacter(TCreature *Actor, const char *Name, int Duration, const char *Reason){ + if(Actor == NULL){ + error("BanishCharacter: Ungültige Kreatur übergeben.\n"); + throw ERROR; + } + + if(Name == NULL){ + error("BanishCharacter: Ungültiger Name übergeben.\n"); + throw ERROR; + } + + if(Reason == NULL){ + error("BanishCharacter: Ungültiger Grund übergeben.\n"); + throw ERROR; + } + + if(Actor->Type != PLAYER){ + error("BanishCharacter: Zauberspruch kann nur von Spielern angewendet werden.\n"); + throw ERROR; + } + + SendMessage(Actor->Connection, TALK_FAILURE_MESSAGE, + "Spell is not available any more. Press Ctrl+Y for the dialog."); +} + +void DeleteCharacter(TCreature *Actor, const char *Name, const char *Reason){ + if(Actor == NULL){ + error("DeleteCharacter: Ungültige Kreatur übergeben.\n"); + throw ERROR; + } + + if(Name == NULL){ + error("DeleteCharacter: Ungültiger Name übergeben.\n"); + throw ERROR; + } + + if(Reason == NULL){ + error("DeleteCharacter: Ungültiger Grund übergeben.\n"); + throw ERROR; + } + + if(Actor->Type != PLAYER){ + error("DeleteCharacter: Zauberspruch kann nur von Spielern angewendet werden.\n"); + throw ERROR; + } + + SendMessage(Actor->Connection, TALK_FAILURE_MESSAGE, + "Spell is not available any more. Press Ctrl+Y for the dialog."); +} + +void IPBanishment(TCreature *Actor, const char *Name, const char *Reason){ + if(Actor == NULL){ + error("IPBanishment: Ungültige Kreatur übergeben.\n"); + throw ERROR; + } + + if(Name == NULL){ + error("IPBanishment: Ungültiger Name übergeben.\n"); + throw ERROR; + } + + if(Reason == NULL){ + error("IPBanishment: Ungültiger Grund übergeben.\n"); + throw ERROR; + } + + if(Actor->Type != PLAYER){ + error("IPBanishment: Zauberspruch kann nur von Spielern angewendet werden.\n"); + throw ERROR; + } + + SendMessage(Actor->Connection, TALK_FAILURE_MESSAGE, + "Spell is not available any more. Press Ctrl+Y for the dialog."); +} + +void SetNameRule(TCreature *Actor, const char *Name){ + if(Actor == NULL){ + error("SetNameRule: Ungültige Kreatur übergeben.\n"); + throw ERROR; + } + + if(Name == NULL){ + error("SetNameRule: Ungültiger Name übergeben.\n"); + throw ERROR; + } + + if(Actor->Type != PLAYER){ + error("SetNameRule: Zauberspruch kann nur von Spieler angewendet werden.\n"); + throw ERROR; + } + + SendMessage(Actor->Connection, TALK_FAILURE_MESSAGE, + "Spell is not available any more."); +} + +void KickPlayer(TCreature *Actor, const char *Name){ + if(Actor == NULL){ + error("KickPlayer: Ungültige Kreatur übergeben.\n"); + throw ERROR; + } + + if(Name == NULL){ + error("KickPlayer: Ungültiger Name übergeben.\n"); + throw ERROR; + } + + if(Actor->Type != PLAYER){ + error("KickPlayer: Zauberspruch kann nur von Spielern angewendet werden.\n"); + throw ERROR; + } + + if(!CheckRight(Actor->ID, KICK)){ + return; + } + + TPlayer *Player; + bool IgnoreGamemasters = !CheckRight(Actor->ID, READ_GAMEMASTER_CHANNEL); + switch(IdentifyPlayer(Name, false, IgnoreGamemasters, &Player)){ + default: + case 0: break; // PLAYERFOUND ? + case -1: throw PLAYERNOTONLINE; + case -2: throw NAMEAMBIGUOUS; + } + + GraphicalEffect(Player->posx, Player->posy, Player->posz, EFFECT_MAGIC_GREEN); + Player->StartLogout(true, true); + SendMessage(Actor->Connection, TALK_INFO_MESSAGE, + "Player %s kicked out of the game.", Player->Name); + Log("banish", "%s kickt %s.\n", Actor->Name, Player->Name); +} + +void HomeTeleport(TCreature *Actor, const char *Name){ + if(Actor == NULL){ + error("HomeTeleport: Ungültige Kreatur übergeben.\n"); + throw ERROR; + } + + if(Name == NULL || Name[0] == 0){ + error("HomeTeleport: Name existiert nicht.\n"); + throw ERROR; + } + + if(Actor->Type != PLAYER){ + error("HomeTeleport: Zauberspruch kann nur von Spielern angewendet werden.\n"); + throw ERROR; + } + + if(!CheckRight(Actor->ID, HOME_TELEPORT)){ + return; + } + + TPlayer *Player; + bool IgnoreGamemasters = !CheckRight(Actor->ID, READ_GAMEMASTER_CHANNEL); + switch(IdentifyPlayer(Name, false, IgnoreGamemasters, &Player)){ + default: + case 0: break; // PLAYERFOUND ? + case -1: throw PLAYERNOTONLINE; + case -2: throw NAMEAMBIGUOUS; + } + + Object Dest = GetMapContainer(Player->startx, Player->starty, Player->startz); + GraphicalEffect(Player->posx, Player->posy, Player->posz, EFFECT_POFF); + Move(0, Player->CrObject, Dest, -1, false, NONE); + GraphicalEffect(Player->posx, Player->posy, Player->posz, EFFECT_TELEPORT); + + SendMessage(Actor->Connection, TALK_INFO_MESSAGE, + "Player %s has been moved to the temple.", Player->Name); + Log("banish", "%s teleportiert %s zum Tempel.\n", Actor->Name, Player->Name); +} + // Magic Init Functions // ============================================================================= static void InitCircles(void){ -- cgit v1.2.3