forked from opentibiabr/canary
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into golden-outfit-to-kv
- Loading branch information
Showing
101 changed files
with
1,740 additions
and
744 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
name: MySQL Schema Check | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
paths: | ||
- "schema.sql" | ||
merge_group: | ||
push: | ||
paths: | ||
- "schema.sql" | ||
branches: | ||
- main | ||
|
||
jobs: | ||
mysql-schema-check: | ||
runs-on: ubuntu-latest | ||
services: | ||
mysql: | ||
image: mysql:8.0 | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: canary | ||
MYSQL_USER: canary | ||
MYSQL_PASSWORD: canary | ||
ports: | ||
- 3306/tcp | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
strategy: | ||
fail-fast: false | ||
name: Check | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@main | ||
- name: 📌 MySQL Start & init & show db | ||
run: | | ||
sudo /etc/init.d/mysql start | ||
mysql -e 'CREATE DATABASE canary;' -uroot -proot | ||
mysql -e "SHOW DATABASES" -uroot -proot | ||
- name: Import Canary Schema | ||
run: | | ||
mysql -uroot -proot canary < schema.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,56 @@ | ||
function onUpdateDatabase() | ||
return false -- true = There are others migrations file | false = this is the last migration file | ||
logger.info("Updating database to version 46 (feat: vip groups)") | ||
|
||
db.query([[ | ||
CREATE TABLE IF NOT EXISTS `account_vipgroups` ( | ||
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, | ||
`account_id` int(11) UNSIGNED NOT NULL COMMENT 'id of account whose vip group entry it is', | ||
`name` varchar(128) NOT NULL, | ||
`customizable` BOOLEAN NOT NULL DEFAULT '1', | ||
CONSTRAINT `account_vipgroups_pk` PRIMARY KEY (`id`, `account_id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
]]) | ||
|
||
db.query([[ | ||
CREATE TRIGGER `oncreate_accounts` AFTER INSERT ON `accounts` FOR EACH ROW BEGIN | ||
INSERT INTO `account_vipgroups` (`account_id`, `name`, `customizable`) VALUES (NEW.`id`, 'Enemies', 0); | ||
INSERT INTO `account_vipgroups` (`account_id`, `name`, `customizable`) VALUES (NEW.`id`, 'Friends', 0); | ||
INSERT INTO `account_vipgroups` (`account_id`, `name`, `customizable`) VALUES (NEW.`id`, 'Trading Partner', 0); | ||
END; | ||
]]) | ||
|
||
db.query([[ | ||
CREATE TABLE IF NOT EXISTS `account_vipgrouplist` ( | ||
`account_id` int(11) UNSIGNED NOT NULL COMMENT 'id of account whose viplist entry it is', | ||
`player_id` int(11) NOT NULL COMMENT 'id of target player of viplist entry', | ||
`vipgroup_id` int(11) UNSIGNED NOT NULL COMMENT 'id of vip group that player belongs', | ||
INDEX `account_id` (`account_id`), | ||
INDEX `player_id` (`player_id`), | ||
INDEX `vipgroup_id` (`vipgroup_id`), | ||
CONSTRAINT `account_vipgrouplist_unique` UNIQUE (`account_id`, `player_id`, `vipgroup_id`), | ||
CONSTRAINT `account_vipgrouplist_player_fk` | ||
FOREIGN KEY (`player_id`) REFERENCES `players` (`id`) | ||
ON DELETE CASCADE, | ||
CONSTRAINT `account_vipgrouplist_vipgroup_fk` | ||
FOREIGN KEY (`vipgroup_id`, `account_id`) REFERENCES `account_vipgroups` (`id`, `account_id`) | ||
ON DELETE CASCADE | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8; | ||
]]) | ||
|
||
db.query([[ | ||
INSERT INTO `account_vipgroups` (`id`, `account_id`, `name`, `customizable`) | ||
SELECT 1, id, 'Friends', 0 FROM `accounts`; | ||
]]) | ||
|
||
db.query([[ | ||
INSERT INTO `account_vipgroups` (`id`, `account_id`, `name`, `customizable`) | ||
SELECT 2, id, 'Enemies', 0 FROM `accounts`; | ||
]]) | ||
|
||
db.query([[ | ||
INSERT INTO `account_vipgroups` (`id`, `account_id`, `name`, `customizable`) | ||
SELECT 3, id, 'Trading Partners', 0 FROM `accounts`; | ||
]]) | ||
|
||
return true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
function onUpdateDatabase() | ||
return false -- true = There are others migrations file | false = this is the last migration file | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
local internalNpcName = "An Idol" | ||
local npcType = Game.createNpcType(internalNpcName) | ||
local npcConfig = {} | ||
|
||
npcConfig.name = internalNpcName | ||
npcConfig.description = internalNpcName | ||
|
||
npcConfig.health = 100 | ||
npcConfig.maxHealth = npcConfig.health | ||
npcConfig.walkInterval = 0 | ||
npcConfig.walkRadius = 2 | ||
|
||
npcConfig.outfit = { | ||
lookTypeEx = 15894, | ||
} | ||
|
||
npcConfig.flags = { | ||
floorchange = false, | ||
} | ||
|
||
local keywordHandler = KeywordHandler:new() | ||
local npcHandler = NpcHandler:new(keywordHandler) | ||
|
||
npcType.onThink = function(npc, interval) | ||
npcHandler:onThink(npc, interval) | ||
end | ||
|
||
npcType.onAppear = function(npc, creature) | ||
npcHandler:onAppear(npc, creature) | ||
end | ||
|
||
npcType.onDisappear = function(npc, creature) | ||
npcHandler:onDisappear(npc, creature) | ||
end | ||
|
||
npcType.onMove = function(npc, creature, fromPosition, toPosition) | ||
npcHandler:onMove(npc, creature, fromPosition, toPosition) | ||
end | ||
|
||
npcType.onSay = function(npc, creature, type, message) | ||
npcHandler:onSay(npc, creature, type, message) | ||
end | ||
|
||
npcType.onCloseChannel = function(npc, creature) | ||
npcHandler:onCloseChannel(npc, creature) | ||
end | ||
|
||
local function creatureSayCallback(npc, creature, type, message) | ||
local player = Player(creature) | ||
|
||
if not npcHandler:checkInteraction(npc, creature) then | ||
return false | ||
end | ||
|
||
if MsgContains(message, "VBOX") then | ||
npcHandler:say("J-T B^C J^BXT°", npc, creature) | ||
player:teleportTo(Position(32366, 32531, 8), false) | ||
player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) | ||
end | ||
|
||
return true | ||
end | ||
|
||
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) | ||
npcHandler:addModule(FocusModule:new(), npcConfig.name, true, true, false) | ||
|
||
-- npcType registering the npcConfig table | ||
npcType:register(npcConfig) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.