Show
Ignore:
Timestamp:
11/22/08 00:35:41 (17 years ago)
Author:
yumileroy
Message:

Delete possessed AI only on creature delete.

Original author: gvcoman
Date: 2008-11-16 14:38:02-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Level3.cpp

    r260 r272  
    136136    HandleReloadSpellScriptsCommand("a"); 
    137137    SendGlobalSysMessage("DB tables `*_scripts` reloaded."); 
    138     HandleReloadDbScriptStringCommand("a"); 
    139138    return true; 
    140139} 
     
    600599        SendGlobalSysMessage("DB table `spell_scripts` reloaded."); 
    601600 
    602     return true; 
    603 } 
    604  
    605 bool ChatHandler::HandleReloadDbScriptStringCommand(const char* arg) 
    606 { 
    607     sLog.outString( "Re-Loading Script strings from `db_script_string`..."); 
    608     objmgr.LoadDbScriptStrings(); 
    609     SendGlobalSysMessage("DB table `db_script_string` reloaded."); 
    610601    return true; 
    611602} 
     
    17771768        // search highest talent rank 
    17781769        uint32 spellid = 0; 
    1779         int rank = 4; 
    1780         for(; rank >= 0; --rank) 
     1770        for(int rank = 4; rank >= 0; --rank) 
    17811771        { 
    17821772            if(talentInfo->RankID[rank]!=0) 
     
    46564646} 
    46574647 
    4658 bool ChatHandler::HandleServerShutDownCancelCommand(const char* args) 
    4659 { 
    4660     sWorld.ShutdownCancel(); 
    4661     return true; 
    4662 } 
    4663  
    4664 bool ChatHandler::HandleServerShutDownCommand(const char* args) 
     4648bool ChatHandler::HandleShutDownCommand(const char* args) 
    46654649{ 
    46664650    if(!*args) 
    46674651        return false; 
    46684652 
    4669     char* time_str = strtok ((char*) args, " "); 
    4670     char* exitcode_str = strtok (NULL, ""); 
    4671  
    4672     int32 time = atoi (time_str); 
    4673  
    4674     ///- Prevent interpret wrong arg value as 0 secs shutdown time 
    4675     if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) 
    4676         return false; 
    4677  
    4678     if (exitcode_str) 
    4679     { 
    4680         int32 exitcode = atoi (exitcode_str); 
    4681  
    4682         // Handle atoi() errors 
    4683         if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) 
     4653    if(std::string(args)=="cancel") 
     4654    { 
     4655        sWorld.ShutdownCancel(); 
     4656    } 
     4657    else 
     4658    { 
     4659        int32 time = atoi(args); 
     4660 
     4661        ///- Prevent interpret wrong arg value as 0 secs shutdown time 
     4662        if(time == 0 && (args[0]!='0' || args[1]!='\0') || time < 0) 
    46844663            return false; 
    46854664 
    4686         // Exit code should be in range of 0-125, 126-255 is used 
    4687         // in many shells for their own return codes and code > 255 
    4688         // is not supported in many others 
    4689         if (exitcode < 0 || exitcode > 125) 
     4665        sWorld.ShutdownServ(time); 
     4666    } 
     4667    return true; 
     4668} 
     4669 
     4670bool ChatHandler::HandleRestartCommand(const char* args) 
     4671{ 
     4672    if(!*args) 
     4673        return false; 
     4674 
     4675    if(std::string(args)=="cancel") 
     4676    { 
     4677        sWorld.ShutdownCancel(); 
     4678    } 
     4679    else 
     4680    { 
     4681        int32 time = atoi(args); 
     4682 
     4683        ///- Prevent interpret wrong arg value as 0 secs shutdown time 
     4684        if(time == 0 && (args[0]!='0' || args[1]!='\0') || time < 0) 
    46904685            return false; 
    46914686 
    4692         sWorld.ShutdownServ (time, 0, exitcode); 
     4687        sWorld.ShutdownServ(time, SHUTDOWN_MASK_RESTART); 
     4688    } 
     4689    return true; 
     4690} 
     4691 
     4692bool ChatHandler::HandleIdleRestartCommand(const char* args) 
     4693{ 
     4694    if(!*args) 
     4695        return false; 
     4696 
     4697    if(std::string(args)=="cancel") 
     4698    { 
     4699        sWorld.ShutdownCancel(); 
    46934700    } 
    46944701    else 
    4695         sWorld.ShutdownServ(time,0,SHUTDOWN_EXIT_CODE); 
    4696     return true; 
    4697 } 
    4698  
    4699 bool ChatHandler::HandleServerRestartCommand(const char* args) 
     4702    { 
     4703        int32 time = atoi(args); 
     4704 
     4705        ///- Prevent interpret wrong arg value as 0 secs shutdown time 
     4706        if(time == 0 && (args[0]!='0' || args[1]!='\0') || time < 0) 
     4707            return false; 
     4708 
     4709        sWorld.ShutdownServ(time,SHUTDOWN_MASK_RESTART+SHUTDOWN_MASK_IDLE); 
     4710    } 
     4711    return true; 
     4712} 
     4713 
     4714bool ChatHandler::HandleIdleShutDownCommand(const char* args) 
    47004715{ 
    47014716    if(!*args) 
    47024717        return false; 
    47034718 
    4704     char* time_str = strtok ((char*) args, " "); 
    4705     char* exitcode_str = strtok (NULL, ""); 
    4706  
    4707     int32 time = atoi (time_str); 
    4708  
    4709     ///- Prevent interpret wrong arg value as 0 secs shutdown time 
    4710     if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) 
    4711         return false; 
    4712  
    4713     if (exitcode_str) 
    4714     { 
    4715         int32 exitcode = atoi (exitcode_str); 
    4716  
    4717         // Handle atoi() errors 
    4718         if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) 
     4719    if(std::string(args)=="cancel") 
     4720    { 
     4721        sWorld.ShutdownCancel(); 
     4722    } 
     4723    else 
     4724    { 
     4725        int32 time = atoi(args); 
     4726 
     4727        ///- Prevent interpret wrong arg value as 0 secs shutdown time 
     4728        if(time == 0 && (args[0]!='0' || args[1]!='\0') || time < 0) 
    47194729            return false; 
    47204730 
    4721         // Exit code should be in range of 0-125, 126-255 is used 
    4722         // in many shells for their own return codes and code > 255 
    4723         // is not supported in many others 
    4724         if (exitcode < 0 || exitcode > 125) 
    4725             return false; 
    4726  
    4727         sWorld.ShutdownServ (time, SHUTDOWN_MASK_RESTART, exitcode); 
    4728     } 
    4729     else 
    4730         sWorld.ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE); 
    4731     return true; 
    4732 } 
    4733  
    4734 bool ChatHandler::HandleServerIdleRestartCommand(const char* args) 
    4735 { 
    4736     if(!*args) 
    4737         return false; 
    4738  
    4739     char* time_str = strtok ((char*) args, " "); 
    4740     char* exitcode_str = strtok (NULL, ""); 
    4741  
    4742     int32 time = atoi (time_str); 
    4743  
    4744     ///- Prevent interpret wrong arg value as 0 secs shutdown time 
    4745     if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) 
    4746         return false; 
    4747  
    4748     if (exitcode_str) 
    4749     { 
    4750         int32 exitcode = atoi (exitcode_str); 
    4751  
    4752         // Handle atoi() errors 
    4753         if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) 
    4754             return false; 
    4755  
    4756         // Exit code should be in range of 0-125, 126-255 is used 
    4757         // in many shells for their own return codes and code > 255 
    4758         // is not supported in many others 
    4759         if (exitcode < 0 || exitcode > 125) 
    4760             return false; 
    4761  
    4762         sWorld.ShutdownServ (time, SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE, exitcode); 
    4763     } 
    4764     else 
    4765         sWorld.ShutdownServ(time,SHUTDOWN_MASK_RESTART|SHUTDOWN_MASK_IDLE,RESTART_EXIT_CODE); 
    4766     return true; 
    4767 } 
    4768  
    4769 bool ChatHandler::HandleServerIdleShutDownCommand(const char* args) 
    4770 { 
    4771     if(!*args) 
    4772         return false; 
    4773  
    4774     char* time_str = strtok ((char*) args, " "); 
    4775     char* exitcode_str = strtok (NULL, ""); 
    4776  
    4777     int32 time = atoi (time_str); 
    4778  
    4779     ///- Prevent interpret wrong arg value as 0 secs shutdown time 
    4780     if(time == 0 && (time_str[0]!='0' || time_str[1]!='\0') || time < 0) 
    4781         return false; 
    4782  
    4783     if (exitcode_str) 
    4784     { 
    4785         int32 exitcode = atoi (exitcode_str); 
    4786  
    4787         // Handle atoi() errors 
    4788         if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0')) 
    4789             return false; 
    4790  
    4791         // Exit code should be in range of 0-125, 126-255 is used 
    4792         // in many shells for their own return codes and code > 255 
    4793         // is not supported in many others 
    4794         if (exitcode < 0 || exitcode > 125) 
    4795             return false; 
    4796  
    4797         sWorld.ShutdownServ (time, SHUTDOWN_MASK_IDLE, exitcode); 
    4798     } 
    4799     else 
    4800         sWorld.ShutdownServ(time,SHUTDOWN_MASK_IDLE,SHUTDOWN_EXIT_CODE); 
     4731        sWorld.ShutdownServ(time,SHUTDOWN_MASK_IDLE); 
     4732    } 
    48014733    return true; 
    48024734}