From 1a016e9421e43f98685d875b381dc19656290f32 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 4 Mar 2019 03:06:06 +0000 Subject: [PATCH] finish removing the account map stuff --- .../database/login_packages/login.plsql | 92 +++++-------------- game/server/database/schema/account_map.tab | 9 -- 2 files changed, 23 insertions(+), 78 deletions(-) delete mode 100644 game/server/database/schema/account_map.tab diff --git a/game/server/database/login_packages/login.plsql b/game/server/database/login_packages/login.plsql index 6f1b1cfd..02695492 100644 --- a/game/server/database/login_packages/login.plsql +++ b/game/server/database/login_packages/login.plsql @@ -1,42 +1,4 @@ - CREATE OR REPLACE PACKAGE "LOGIN" -as - type refcursor is ref cursor; - subtype objectid is number; - - procedure register_new_cluster(p_cluster_name in varchar2, p_address in varchar2, p_cluster_id out number); - function get_cluster_list(p_group in number) return refcursor; - function get_avatar_list (p_station_id number, p_cluster_group number) return refcursor; - function get_open_character_slots(p_station_id number, p_cluster_id number) return refcursor; - function get_only_open_character_slots(p_station_id number, p_cluster_id number) return refcursor; - function is_cluster_at_limit(p_cluster_id number) return number; - function is_account_at_limit(p_station_id number) return number; - procedure delete_character(p_cluster_id number, p_character_id number, p_station_id number); - procedure rename_character(p_cluster_id number, p_character_id number, p_new_name varchar2); - procedure create_character(p_cluster_id number, p_station_id number, p_character_name varchar2, p_character_id number, p_template_id number, p_character_type number); - function restore_character(p_cluster_id number, p_station_id number, p_character_name varchar2, p_character_id number, p_template_id number, p_character_type number) return number; - procedure set_character_slots(p_cluster_id number, p_station_id number, p_slot_type number, p_num_slots number); - procedure set_character_type(p_cluster_id number, p_station_id number, p_character_id number, p_slot_type number); - function has_extra_character_slot(p_station_id number, p_character_type number) return number; - procedure toggle_disable_character(p_cluster_id number, p_character_id number, p_station_id number, p_enabled varchar2); - function enable_disable_character(p_station_id number, p_character_id number, p_enabled varchar2) return number; - function get_completed_tutorial(p_station_id number) return refcursor; - procedure toggle_completed_tutorial(p_station_id number, p_completed varchar2); - function get_consumed_reward_events(p_station_id number) return refcursor; - function get_claimed_reward_items(p_station_id number) return refcursor; - function consume_reward_event(p_station_id number, p_character_id number, p_cluster_id number, p_event_id varchar2) return number; - function claim_reward_item(p_station_id number, p_character_id number, p_cluster_id number, p_item_id varchar2) return number; - function get_feature_id_transactions(p_station_id in number, p_cluster_id in number, p_character_id in number) return refcursor; - function update_feature_id_transaction(p_station_id in number, p_cluster_id in number, p_character_id in number, p_item_id in varchar2, p_count_adjustment in number) return number; -end; - -/ - - GRANT EXECUTE ON "LOGIN" TO PUBLIC; --------------------------------------------------------- --- DDL for Package Body LOGIN --------------------------------------------------------- - - CREATE OR REPLACE PACKAGE BODY "LOGIN" +create or replace package body login as procedure register_new_cluster(p_cluster_name in varchar2, p_address in varchar2, p_cluster_id out number) @@ -54,7 +16,7 @@ as select nvl(max(id)+1,1), p_cluster_name,p_address,'N','N','N',1, 2500,250,'Y',350 from cluster_list; - + select id into p_cluster_id from cluster_list @@ -68,7 +30,7 @@ as begin select account_limit into maxCharacterPerAccount from default_char_limits; - + open result_cursor for select id, name, address, port, secret, locked, not_recommended, maxCharacterPerAccount, online_player_limit,online_free_trial_limit,free_trial_can_create_char,online_tutorial_limit @@ -112,10 +74,7 @@ as into over_account_limit, over_cluster_limit from (select count(*) num from swg_characters - where (station_id = p_station_id - OR station_id IN (SELECT CASE WHEN child_id = p_station_id THEN parent_id - ELSE child_id END as station_id FROM account_map WHERE parent_id = p_station_id - OR child_id = p_station_id)) and enabled ='Y') account_counter, + where station_id = p_station_id and enabled ='Y' and cluster_id not in (select id from cluster_list where name in ('Corbantis', 'Europe-Infinity', 'Intrepid', 'Kauri', 'Kettemoor', 'Lowca', 'Naritus', 'Scylla', 'Tarquinas', 'Tempest', 'Valcyn', 'Wanderhome', 'Japan-Katana', 'Japan-Harla'))) account_counter, default_char_limits, cluster_list where @@ -131,7 +90,7 @@ as end if; -- if not, return the number of each type of character we're allowed to create - + open result_cursor for select limits.character_type_id, limits.limit - nvl(existing.num,0) remaining_slots from @@ -152,7 +111,7 @@ as return result_cursor; end; - + -- unlike get_open_character_slots, this function ignores account and cluster limits function get_only_open_character_slots(p_station_id number, p_cluster_id number) return refcursor as @@ -180,16 +139,16 @@ as return result_cursor; end; - + function is_cluster_at_limit(p_cluster_id number) return number - as + as v_cluster_limit number; v_num_characters number; begin select cluster_limit into v_cluster_limit from default_char_limits; - + select num_characters into v_num_characters from cluster_list @@ -205,9 +164,9 @@ as when others then return 0; end; - + function is_account_at_limit(p_station_id number) return number - as + as v_account_limit number; v_num_characters number; begin @@ -259,7 +218,7 @@ as begin insert into swg_characters (station_id, cluster_id, character_name, object_id, template_id, character_type) values (p_station_id, p_cluster_id, p_character_name, p_character_id, p_template_id, p_character_type); - + update cluster_list set num_characters = nvl(num_characters,0) + 1 where cluster_list.id = p_cluster_id; @@ -272,7 +231,7 @@ as where cluster_id = p_cluster_id and station_id = p_station_id and character_name = p_character_name; - end; + end; function restore_character(p_cluster_id number, p_station_id number, p_character_name varchar2, p_character_id number, p_template_id number, p_character_type number) return number -- Return codes: @@ -286,7 +245,7 @@ as begin insert into swg_characters (station_id, cluster_id, character_name, object_id, template_id, character_type) values (p_station_id, p_cluster_id, p_character_name, p_character_id, p_template_id, p_character_type); - + update cluster_list set num_characters = nvl(num_characters,0) + 1 where cluster_list.id = p_cluster_id; @@ -323,7 +282,7 @@ as exception when others then return 3; - end; + end; procedure set_character_slots(p_cluster_id number, p_station_id number, p_slot_type number, p_num_slots number) as @@ -349,14 +308,14 @@ as and cluster_id = p_cluster_id and object_id = p_character_id; end; - + function has_extra_character_slot(p_station_id number, p_character_type number) return number as rows number; total number; begin select count(*), sum(num_extra_slots) - into rows, total + into rows, total from extra_character_slots where station_id = p_station_id and character_type_id = p_character_type; @@ -440,7 +399,7 @@ as return result_cursor; end; - + function get_claimed_reward_items(p_station_id number) return refcursor as result_cursor refcursor; @@ -477,7 +436,7 @@ as if ((p_cluster_id=previous_claim_cluster) and (p_character_id=previous_claim_character)) then return 1; end if; - + return 0; end; when others then @@ -508,7 +467,7 @@ as if ((p_cluster_id=previous_claim_cluster) and (p_character_id=previous_claim_character)) then return 1; end if; - + return 0; exception when others then @@ -517,7 +476,7 @@ as when others then return 0; end; - + function get_feature_id_transactions(p_station_id in number, p_cluster_id in number, p_character_id in number) return refcursor as result_cursor refcursor; @@ -529,7 +488,7 @@ as return result_cursor; end; - + function update_feature_id_transaction(p_station_id in number, p_cluster_id in number, p_character_id in number, p_item_id in varchar2, p_count_adjustment in number) return number as begin @@ -544,7 +503,7 @@ as insert into feature_id_transactions (station_id, cluster_id, character_id, item_id, date_updated, count) values (p_station_id, p_cluster_id, p_character_id, p_item_id, sysdate, p_count_adjustment); end if; - + return 1; exception @@ -552,9 +511,4 @@ as return 0; end; end; - / - - GRANT EXECUTE ON "LOGIN" TO PUBLIC; - COMMIT; -EXIT; diff --git a/game/server/database/schema/account_map.tab b/game/server/database/schema/account_map.tab deleted file mode 100644 index c8fbe7e2..00000000 --- a/game/server/database/schema/account_map.tab +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "ACCOUNT_MAP" -( - "PARENT_ID" NUMBER(38,0) NOT NULL ENABLE, - "CHILD_ID" NUMBER(38,0) NOT NULL ENABLE, - CONSTRAINT "ACCOUNT_MAP_UK1" UNIQUE ("CHILD_ID", "PARENT_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX2" ON "ACCOUNT_MAP" ("CHILD_ID","PARENT_ID")), - CONSTRAINT "ACCOUNT_MAP_UK2" UNIQUE ("CHILD_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX1" ON "ACCOUNT_MAP" ("CHILD_ID")) -); - -grant select on account_map to public;