Advertisement
ruizit0

Untitled

Aug 8th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. BEGIN
  2. declare eqContID, invContID, delCharacterID int unsigned default null;
  3. declare isCharFound tinyint unsigned default 0; -- not found by default
  4.  
  5. declare exit handler for sqlexception
  6. begin
  7. rollback;
  8. resignal;
  9. end;
  10.  
  11. select EquipmentContainerID, RootContainerID from `character` where id = inCharID and AccountID = inAccID
  12. into eqContID, invContID;
  13.  
  14. if(eqContID is not null and invContID is not null) then
  15. set isCharFound = 1; -- found
  16.  
  17. START TRANSACTION;
  18.  
  19. DELETE FROM skills WHERE CharacterID = inCharID;
  20. DELETE FROM equipment_slots WHERE CharacterID = inCharID;
  21. DELETE FROM character_wounds WHERE CharacterID = inCharID;
  22. DELETE FROM character_titles WHERE CharacterID = inCharID;
  23. DELETE FROM character_effects WHERE CharacterID = inCharID;
  24. -- DELETE FROM guest_links WHERE characterId = inCharID;
  25.  
  26. -- personal_lands -> claims -> (claim_rules, unmovable_objects_claims)
  27. DELETE FROM claim_rules WHERE ClaimID IN (SELECT ID FROM claims WHERE PersonalLandID IN (SELECT ID FROM personal_lands WHERE CharID = inCharID));
  28. DELETE FROM unmovable_objects_claims WHERE ClaimID IN (SELECT ID FROM claims WHERE PersonalLandID IN (SELECT ID FROM personal_lands WHERE CharID = inCharID));
  29. DELETE FROM claims WHERE PersonalLandID IN (SELECT ID FROM personal_lands WHERE CharID = inCharID);
  30. DELETE FROM personal_lands WHERE CharID = inCharID;
  31.  
  32. -- claim_subjects -> (claim_rules, claim_rules_unmovable)
  33. DELETE FROM claim_rules WHERE ClaimSubjectID IN (SELECT ID FROM claim_subjects WHERE CharID = inCharID);
  34. DELETE FROM claim_rules_unmovable WHERE ClaimSubjectID IN (SELECT ID FROM claim_subjects WHERE CharID = inCharID);
  35. DELETE FROM claim_subjects WHERE CharID = inCharID;
  36.  
  37. -- DELETE FROM minigame_results WHERE characterID = inCharID;
  38. DELETE FROM food_eaten WHERE CharID = inCharID;
  39. -- DELETE FROM guild_actions WHERE CharID = inCharID;
  40. -- DELETE FROM guild_actions WHERE ProducerCharID = inCharID;
  41. DELETE FROM chars_deathlog WHERE CharID = inCharID;
  42. DELETE FROM chars_deathlog WHERE KillerID = inCharID;
  43. DELETE FROM skill_raise_logs WHERE PlayerID = inCharID;
  44.  
  45. UPDATE movable_objects SET CarrierCharacterID = NULL WHERE CarrierCharacterID = inCharID;
  46. UPDATE movable_objects SET OwnerID = NULL, DroppedTime = 0 WHERE OwnerID = inCharID;
  47. UPDATE unmovable_objects SET OwnerID = NULL, DroppedTime = 0 WHERE OwnerID = inCharID;
  48. -- _cm_old_cmLocks
  49. -- UPDATE geo_data SET PrivatePropertyPlayerID=0 WHERE PrivatePropertyPlayerID = inCharID;
  50. -- /_cm_old_cmLocks
  51.  
  52. -- clear guild_actions_queue data
  53. insert into deleted_character_info
  54. (ExCharID, CharName, CharLastName, AccountID)
  55. select ID, Name, LastName, AccountID from `character` WHERE ID = inCharID;
  56. set delCharacterID = LAST_INSERT_ID();
  57.  
  58. DELETE FROM guild_actions_queue where ProducerCharID = inCharID or CharID = inCharID;
  59. UPDATE guild_actions_processed set ProducerCharDeletedID = delCharacterID, ProducerCharID = NULL where ProducerCharID = inCharID;
  60. UPDATE guild_actions_processed set CharDeletedID = delCharacterID, CharID = NULL where CharID = inCharID;
  61.  
  62. DELETE FROM `character` WHERE ID = inCharID;
  63.  
  64. CALL f_deleteContainer(eqContID);
  65. CALL f_deleteContainer(invContID);
  66.  
  67. COMMIT;
  68. end if;
  69.  
  70. select isCharFound as `found`;
  71.  
  72. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement