Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN
- declare eqContID, invContID, delCharacterID int unsigned default null;
- declare isCharFound tinyint unsigned default 0; -- not found by default
- declare exit handler for sqlexception
- begin
- rollback;
- resignal;
- end;
- select EquipmentContainerID, RootContainerID from `character` where id = inCharID and AccountID = inAccID
- into eqContID, invContID;
- if(eqContID is not null and invContID is not null) then
- set isCharFound = 1; -- found
- START TRANSACTION;
- DELETE FROM skills WHERE CharacterID = inCharID;
- DELETE FROM equipment_slots WHERE CharacterID = inCharID;
- DELETE FROM character_wounds WHERE CharacterID = inCharID;
- DELETE FROM character_titles WHERE CharacterID = inCharID;
- DELETE FROM character_effects WHERE CharacterID = inCharID;
- -- DELETE FROM guest_links WHERE characterId = inCharID;
- -- personal_lands -> claims -> (claim_rules, unmovable_objects_claims)
- DELETE FROM claim_rules WHERE ClaimID IN (SELECT ID FROM claims WHERE PersonalLandID IN (SELECT ID FROM personal_lands WHERE CharID = inCharID));
- DELETE FROM unmovable_objects_claims WHERE ClaimID IN (SELECT ID FROM claims WHERE PersonalLandID IN (SELECT ID FROM personal_lands WHERE CharID = inCharID));
- DELETE FROM claims WHERE PersonalLandID IN (SELECT ID FROM personal_lands WHERE CharID = inCharID);
- DELETE FROM personal_lands WHERE CharID = inCharID;
- -- claim_subjects -> (claim_rules, claim_rules_unmovable)
- DELETE FROM claim_rules WHERE ClaimSubjectID IN (SELECT ID FROM claim_subjects WHERE CharID = inCharID);
- DELETE FROM claim_rules_unmovable WHERE ClaimSubjectID IN (SELECT ID FROM claim_subjects WHERE CharID = inCharID);
- DELETE FROM claim_subjects WHERE CharID = inCharID;
- -- DELETE FROM minigame_results WHERE characterID = inCharID;
- DELETE FROM food_eaten WHERE CharID = inCharID;
- -- DELETE FROM guild_actions WHERE CharID = inCharID;
- -- DELETE FROM guild_actions WHERE ProducerCharID = inCharID;
- DELETE FROM chars_deathlog WHERE CharID = inCharID;
- DELETE FROM chars_deathlog WHERE KillerID = inCharID;
- DELETE FROM skill_raise_logs WHERE PlayerID = inCharID;
- UPDATE movable_objects SET CarrierCharacterID = NULL WHERE CarrierCharacterID = inCharID;
- UPDATE movable_objects SET OwnerID = NULL, DroppedTime = 0 WHERE OwnerID = inCharID;
- UPDATE unmovable_objects SET OwnerID = NULL, DroppedTime = 0 WHERE OwnerID = inCharID;
- -- _cm_old_cmLocks
- -- UPDATE geo_data SET PrivatePropertyPlayerID=0 WHERE PrivatePropertyPlayerID = inCharID;
- -- /_cm_old_cmLocks
- -- clear guild_actions_queue data
- insert into deleted_character_info
- (ExCharID, CharName, CharLastName, AccountID)
- select ID, Name, LastName, AccountID from `character` WHERE ID = inCharID;
- set delCharacterID = LAST_INSERT_ID();
- DELETE FROM guild_actions_queue where ProducerCharID = inCharID or CharID = inCharID;
- UPDATE guild_actions_processed set ProducerCharDeletedID = delCharacterID, ProducerCharID = NULL where ProducerCharID = inCharID;
- UPDATE guild_actions_processed set CharDeletedID = delCharacterID, CharID = NULL where CharID = inCharID;
- DELETE FROM `character` WHERE ID = inCharID;
- CALL f_deleteContainer(eqContID);
- CALL f_deleteContainer(invContID);
- COMMIT;
- end if;
- select isCharFound as `found`;
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement