hexsha
stringlengths 40
40
| size
int64 5
1.05M
| ext
stringclasses 98
values | lang
stringclasses 21
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
118
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
int64 1
368k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
118
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
int64 1
134k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
135
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 5
1.05M
| avg_line_length
float64 1
1.03M
| max_line_length
int64 2
1.03M
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b2cabd96c3fc001d2729753488a402fc76f755f0
| 8,187 |
py
|
Python
|
tests/test_skipping.py
|
pytask-dev/pytask
|
b6769b48abda44c6261b9a7b58865f8844423c13
|
[
"MIT"
] | 41 |
2020-07-24T15:19:19.000Z
|
2022-03-17T17:40:57.000Z
|
tests/test_skipping.py
|
pytask-dev/pytask
|
b6769b48abda44c6261b9a7b58865f8844423c13
|
[
"MIT"
] | 240 |
2020-06-26T21:37:49.000Z
|
2022-03-31T08:56:56.000Z
|
tests/test_skipping.py
|
pytask-dev/pytask
|
b6769b48abda44c6261b9a7b58865f8844423c13
|
[
"MIT"
] | null | null | null |
import textwrap
from contextlib import ExitStack as does_not_raise # noqa: N813
import pytest
from _pytask.mark import Mark
from _pytask.outcomes import Skipped
from _pytask.outcomes import SkippedAncestorFailed
from _pytask.outcomes import SkippedUnchanged
from _pytask.skipping import pytask_execute_task_setup
from pytask import cli
from pytask import main
class DummyClass:
pass
@pytest.mark.end_to_end
def test_skip_unchanged(tmp_path):
source = """
def task_dummy():
pass
"""
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
session = main({"paths": tmp_path})
assert session.execution_reports[0].success
session = main({"paths": tmp_path})
assert isinstance(session.execution_reports[0].exc_info[1], SkippedUnchanged)
@pytest.mark.end_to_end
def test_skip_unchanged_w_dependencies_and_products(tmp_path):
source = """
import pytask
@pytask.mark.depends_on("in.txt")
@pytask.mark.produces("out.txt")
def task_dummy(depends_on, produces):
produces.write_text(depends_on.read_text())
"""
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
tmp_path.joinpath("in.txt").write_text("Original content of in.txt.")
session = main({"paths": tmp_path})
assert session.execution_reports[0].success
assert tmp_path.joinpath("out.txt").read_text() == "Original content of in.txt."
session = main({"paths": tmp_path})
assert isinstance(session.execution_reports[0].exc_info[1], SkippedUnchanged)
assert tmp_path.joinpath("out.txt").read_text() == "Original content of in.txt."
@pytest.mark.end_to_end
def test_skipif_ancestor_failed(tmp_path):
source = """
import pytask
@pytask.mark.produces("out.txt")
def task_first():
assert 0
@pytask.mark.depends_on("out.txt")
def task_second():
pass
"""
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
session = main({"paths": tmp_path})
assert not session.execution_reports[0].success
assert isinstance(session.execution_reports[0].exc_info[1], Exception)
assert not session.execution_reports[1].success
assert isinstance(session.execution_reports[1].exc_info[1], SkippedAncestorFailed)
@pytest.mark.end_to_end
def test_if_skip_decorator_is_applied_to_following_tasks(tmp_path):
source = """
import pytask
@pytask.mark.skip
@pytask.mark.produces("out.txt")
def task_first():
assert 0
@pytask.mark.depends_on("out.txt")
def task_second():
pass
"""
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
session = main({"paths": tmp_path})
assert session.execution_reports[0].success
assert isinstance(session.execution_reports[0].exc_info[1], Skipped)
assert session.execution_reports[1].success
assert isinstance(session.execution_reports[1].exc_info[1], Skipped)
@pytest.mark.end_to_end
@pytest.mark.parametrize(
"mark_string", ["@pytask.mark.skip", "@pytask.mark.skipif(True, reason='bla')"]
)
def test_skip_if_dependency_is_missing(tmp_path, mark_string):
source = f"""
import pytask
{mark_string}
@pytask.mark.depends_on("in.txt")
def task_first():
assert 0
"""
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
session = main({"paths": tmp_path})
assert session.execution_reports[0].success
assert isinstance(session.execution_reports[0].exc_info[1], Skipped)
@pytest.mark.end_to_end
@pytest.mark.parametrize(
"mark_string", ["@pytask.mark.skip", "@pytask.mark.skipif(True, reason='bla')"]
)
def test_skip_if_dependency_is_missing_only_for_one_task(runner, tmp_path, mark_string):
source = f"""
import pytask
{mark_string}
@pytask.mark.depends_on("in.txt")
def task_first():
assert 0
@pytask.mark.depends_on("in.txt")
def task_second():
assert 0
"""
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
result = runner.invoke(cli, [tmp_path.as_posix()])
assert result.exit_code == 4
assert "in.txt" in result.output
assert "task_first" not in result.output
assert "task_second" in result.output
@pytest.mark.end_to_end
def test_if_skipif_decorator_is_applied_skipping(tmp_path):
source = """
import pytask
@pytask.mark.skipif(condition=True, reason="bla")
@pytask.mark.produces("out.txt")
def task_first():
assert False
@pytask.mark.depends_on("out.txt")
def task_second():
assert False
"""
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
session = main({"paths": tmp_path})
node = session.collection_reports[0].node
assert len(node.markers) == 1
assert node.markers[0].name == "skipif"
assert node.markers[0].args == ()
assert node.markers[0].kwargs == {"condition": True, "reason": "bla"}
assert session.execution_reports[0].success
assert isinstance(session.execution_reports[0].exc_info[1], Skipped)
assert session.execution_reports[1].success
assert isinstance(session.execution_reports[1].exc_info[1], Skipped)
assert session.execution_reports[0].exc_info[1].args[0] == "bla"
@pytest.mark.end_to_end
def test_if_skipif_decorator_is_applied_execute(tmp_path):
source = """
import pytask
@pytask.mark.skipif(False, reason="bla")
@pytask.mark.produces("out.txt")
def task_first(produces):
with open(produces, "w") as f:
f.write("hello world.")
@pytask.mark.depends_on("out.txt")
def task_second():
pass
"""
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
session = main({"paths": tmp_path})
node = session.collection_reports[0].node
assert len(node.markers) == 1
assert node.markers[0].name == "skipif"
assert node.markers[0].args == (False,)
assert node.markers[0].kwargs == {"reason": "bla"}
assert session.execution_reports[0].success
assert session.execution_reports[0].exc_info is None
assert session.execution_reports[1].success
assert session.execution_reports[1].exc_info is None
@pytest.mark.end_to_end
def test_if_skipif_decorator_is_applied_any_condition_matches(tmp_path):
"""Any condition of skipif has to be True and only their message is shown."""
source = """
import pytask
@pytask.mark.skipif(condition=False, reason="I am fine")
@pytask.mark.skipif(condition=True, reason="No, I am not.")
@pytask.mark.produces("out.txt")
def task_first():
assert False
@pytask.mark.depends_on("out.txt")
def task_second():
assert False
"""
tmp_path.joinpath("task_dummy.py").write_text(textwrap.dedent(source))
session = main({"paths": tmp_path})
node = session.collection_reports[0].node
assert len(node.markers) == 2
assert node.markers[0].name == "skipif"
assert node.markers[0].args == ()
assert node.markers[0].kwargs == {"condition": True, "reason": "No, I am not."}
assert node.markers[1].name == "skipif"
assert node.markers[1].args == ()
assert node.markers[1].kwargs == {"condition": False, "reason": "I am fine"}
assert session.execution_reports[0].success
assert isinstance(session.execution_reports[0].exc_info[1], Skipped)
assert session.execution_reports[1].success
assert isinstance(session.execution_reports[1].exc_info[1], Skipped)
assert session.execution_reports[0].exc_info[1].args[0] == "No, I am not."
@pytest.mark.unit
@pytest.mark.parametrize(
("marker_name", "expectation"),
[
("skip_unchanged", pytest.raises(SkippedUnchanged)),
("skip_ancestor_failed", pytest.raises(SkippedAncestorFailed)),
("skip", pytest.raises(Skipped)),
("", does_not_raise()),
],
)
def test_pytask_execute_task_setup(marker_name, expectation):
class Task:
pass
task = Task()
kwargs = {"reason": ""} if marker_name == "skip_ancestor_failed" else {}
task.markers = [Mark(marker_name, (), kwargs)]
with expectation:
pytask_execute_task_setup(task)
| 30.662921 | 88 | 0.696836 |
43b552196d8130594d34c2ecab2b6297f6825b7e
| 465 |
go
|
Go
|
pkg/crypto/sha256/sha256.go
|
Shopify/goluago
|
fe0528d0b2041b5122b8c170dfad8a5dc86516fb
|
[
"MIT"
] | 67 |
2015-03-04T19:52:55.000Z
|
2021-11-27T05:22:44.000Z
|
pkg/crypto/sha256/sha256.go
|
Shopify/goluago
|
fe0528d0b2041b5122b8c170dfad8a5dc86516fb
|
[
"MIT"
] | 8 |
2016-02-14T12:56:31.000Z
|
2021-04-14T08:07:49.000Z
|
pkg/crypto/sha256/sha256.go
|
Shopify/goluago
|
fe0528d0b2041b5122b8c170dfad8a5dc86516fb
|
[
"MIT"
] | 11 |
2015-03-08T09:13:05.000Z
|
2020-11-11T17:55:20.000Z
|
package sha256
import (
"crypto/sha256"
"github.com/Shopify/go-lua"
)
func Open(l *lua.State) {
open := func(l *lua.State) int {
lua.NewLibrary(l, library)
return 1
}
lua.Require(l, "goluago/crypto/sha256", open, false)
l.Pop(1)
}
var library = []lua.RegistryFunction{
{"digest", digest},
}
func digest(l *lua.State) int {
message := lua.CheckString(l, 1)
h := sha256.New()
h.Write([]byte(message))
l.PushString(string(h.Sum(nil)))
return 1
}
| 15.5 | 53 | 0.655914 |
8149be46bbdcaee4e7bcb8276e89e3469a1b86ab
| 29 |
rs
|
Rust
|
src/server/objects/wl_callback.rs
|
nuta/kazari
|
cdbd7a2dc4e9e6e0ca6e839f8fb66cf3f077572b
|
[
"MIT"
] | 13 |
2021-03-10T17:14:04.000Z
|
2022-02-03T07:07:33.000Z
|
src/server/objects/wl_callback.rs
|
nuta/kazari
|
cdbd7a2dc4e9e6e0ca6e839f8fb66cf3f077572b
|
[
"MIT"
] | null | null | null |
src/server/objects/wl_callback.rs
|
nuta/kazari
|
cdbd7a2dc4e9e6e0ca6e839f8fb66cf3f077572b
|
[
"MIT"
] | null | null | null |
pub struct CallbackObject {}
| 14.5 | 28 | 0.793103 |
3ee058fc9d912bc3b052cf35cd1f67403bf1d9aa
| 1,763 |
h
|
C
|
System/Library/Frameworks/NetworkExtension.framework/NEIKEv2EAP.h
|
lechium/tvOS135Headers
|
46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac
|
[
"MIT"
] | 2 |
2020-07-26T20:30:54.000Z
|
2020-08-10T04:26:23.000Z
|
System/Library/Frameworks/NetworkExtension.framework/NEIKEv2EAP.h
|
lechium/tvOS135Headers
|
46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac
|
[
"MIT"
] | 1 |
2020-07-26T20:45:31.000Z
|
2020-08-09T09:30:46.000Z
|
System/Library/Frameworks/NetworkExtension.framework/NEIKEv2EAP.h
|
lechium/tvOS135Headers
|
46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac
|
[
"MIT"
] | null | null | null |
/*
* This header is generated by classdump-dyld 1.0
* on Sunday, June 7, 2020 at 11:16:27 AM Mountain Standard Time
* Operating System: Version 13.4.5 (Build 17L562)
* Image Source: /System/Library/Frameworks/NetworkExtension.framework/NetworkExtension
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
#import <NetworkExtension/NetworkExtension-Structs.h>
@class NEIKEv2EAPProtocol, NSMutableData;
@interface NEIKEv2EAP : NSObject {
EAPClientPluginData_s* _pluginData;
NEIKEv2EAPProtocol* _protocol;
EAPClientModule_sRef _module;
}
@property (retain) NEIKEv2EAPProtocol * protocol; //@synthesize protocol=_protocol - In the implementation block
@property (assign) EAPClientModule_sRef module; //@synthesize module=_module - In the implementation block
@property (readonly) NSMutableData * sessionKey;
+(unsigned)codeForPayload:(id)arg1 ;
+(EAPClientModule_sRef)getAKAModule;
+(EAPClientModule_sRef)getSIMModule;
+(EAPClientModule_sRef)getMSCHAPv2Module;
+(EAPClientModule_sRef)getGTCModule;
+(EAPClientModule_sRef)getTLSModule;
+(EAPClientModule_sRef)getPEAPModule;
+(unsigned)typeForPayload:(id)arg1 ;
+(EAPClientModule_sRef)loadModuleForType:(unsigned)arg1 ;
-(id)init;
-(void)dealloc;
-(NEIKEv2EAPProtocol *)protocol;
-(void)setProtocol:(NEIKEv2EAPProtocol *)arg1 ;
-(EAPClientModule_sRef)module;
-(NSMutableData *)sessionKey;
-(void)setModule:(EAPClientModule_sRef)arg1 ;
-(id)copyProperties:(unsigned)arg1 ;
-(id)selectModuleForPayload:(id)arg1 ikeSA:(id)arg2 ;
-(id)createPayloadResponseForRequest:(id)arg1 type:(unsigned)arg2 typeData:(id)arg3 typeString:(id)arg4 ;
-(id)createPayloadResponseForRequest:(id)arg1 ikeSA:(id)arg2 success:(BOOL*)arg3 reportEAPError:(BOOL*)arg4 ;
@end
| 38.326087 | 125 | 0.78616 |
310957839052c26c19f8200848e2165c45cbbf22
| 396 |
swift
|
Swift
|
omokake02/omokake02/Common/Entity/AlbumInfo.swift
|
kokiTakashiki/omokake
|
4d4617e341ccfef8d3406c128c48ca2a0224be7b
|
[
"MIT"
] | null | null | null |
omokake02/omokake02/Common/Entity/AlbumInfo.swift
|
kokiTakashiki/omokake
|
4d4617e341ccfef8d3406c128c48ca2a0224be7b
|
[
"MIT"
] | 6 |
2021-07-09T12:15:51.000Z
|
2021-08-28T14:32:28.000Z
|
omokake02/omokake02/Common/Entity/AlbumInfo.swift
|
kokiTakashiki/omokake
|
4d4617e341ccfef8d3406c128c48ca2a0224be7b
|
[
"MIT"
] | null | null | null |
//
// AlbumInfo.swift
// omokake02
//
// Created by 武田孝騎 on 2021/07/15.
// Copyright © 2021 takasiki. All rights reserved.
//
import Foundation
class AlbumInfo {
var index: Int
var title: String
var photosCount: Int
init(index: Int, title: String, photosCount: Int) {
self.index = index
self.title = title
self.photosCount = photosCount
}
}
| 18 | 55 | 0.623737 |
815735f0f224b12bca9b4b365d0409f9a908b0bf
| 509 |
sql
|
SQL
|
fluxtream-web/db/1.1.3/02_SharedChannels.sql
|
ahujamoh/fluxtream-app
|
40c73028ecb408ef53d0581b5e1641d8d5c34da5
|
[
"Apache-2.0"
] | 89 |
2015-01-21T20:15:47.000Z
|
2021-11-08T09:58:39.000Z
|
fluxtream-web/db/1.1.3/02_SharedChannels.sql
|
fluxtream/fluxtream-app
|
40c73028ecb408ef53d0581b5e1641d8d5c34da5
|
[
"Apache-2.0"
] | 30 |
2020-01-13T05:27:46.000Z
|
2021-08-02T17:08:02.000Z
|
fluxtream-web/db/1.1.3/02_SharedChannels.sql
|
ahujamoh/fluxtream-app
|
40c73028ecb408ef53d0581b5e1641d8d5c34da5
|
[
"Apache-2.0"
] | 31 |
2015-02-18T06:16:01.000Z
|
2022-03-29T15:09:39.000Z
|
CREATE TABLE `SharedChannels` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`buddy_id` bigint(20) DEFAULT NULL,
`channelMapping_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FKFD3DCB7568CEBFC9` (`buddy_id`),
KEY `FKFD3DCB752E0740A3` (`channelMapping_id`),
CONSTRAINT `FKFD3DCB752E0740A3` FOREIGN KEY (`channelMapping_id`) REFERENCES `ChannelMapping` (`id`),
CONSTRAINT `FKFD3DCB7568CEBFC9` FOREIGN KEY (`buddy_id`) REFERENCES `CoachingBuddies` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
| 50.9 | 103 | 0.750491 |
27a72524e41c91f68f6108c5fc6b7cf1eeb4aa07
| 13,880 |
css
|
CSS
|
www/css/model.css
|
palmerhargreaves/nfz
|
669c124dd5cedb064c00edc6095c5b851d9ca3d8
|
[
"Unlicense"
] | null | null | null |
www/css/model.css
|
palmerhargreaves/nfz
|
669c124dd5cedb064c00edc6095c5b851d9ca3d8
|
[
"Unlicense"
] | 1 |
2018-09-17T11:34:55.000Z
|
2018-09-17T13:06:04.000Z
|
www/css/model.css
|
palmerhargreaves/nfz
|
669c124dd5cedb064c00edc6095c5b851d9ca3d8
|
[
"Unlicense"
] | null | null | null |
.modal.model {
top: 25px;
width: 759px;
margin-left: -361px;
padding: 0px 9px 0px;
border-radius: 4px;
display: none;
}
.modal.model .modal-header {
position: relative;
height: 54px;
margin: 0px -9px;
padding-top: 0px;
padding-bottom: 0px;
background: #ececec;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom: 1px solid #c2cacc;
}
/* Tabs */
.modal.model .modal-header .tabs {
position: absolute;
top: 18px;
}
.modal.model .modal-header .tabs .tab {
border-bottom: 1px solid #c2cacc;
}
.modal.model .modal-header .tabs .tab.active {
border-bottom: 1px solid #ffffff;
}
.modal.model .modal-header .tabs .tab.disabled {
color: #cccccc;
cursor: default;
}
.modal.model .modal-header .tabs .tab span {
height: 35px;
width: 169px;
padding: 0;
text-align: center;
}
.modal.model .modal-header .tabs .tab span:before {
position: absolute;
top: 9px;
left: 18px;
width: 18px;
height: 23px;
content: "";
}
.modal.model .modal-header .tabs .tab.wait span:before, .modal.model .modal-header .tabs .tab.wait_specialist span:before {
background: url('../images/table-icons.png') 0px -158px no-repeat;
}
.modal.model .modal-header .tabs .tab.accepted span:before {
background: url('../images/ok-icon-active.png') 0px 1px no-repeat;
}
.modal.model .modal-header .tabs .tab.declined span:before {
background: url('../images/table-icons.png') 0px -180px no-repeat;
}
.modal.model .modal-header .tabs .tab.pencil span:before {
background: url('../images/table-icons.png') 0px -180px no-repeat;
}
.modal.model .modal-header .tabs .tab.clock span:before {
background: url('../images/table-icons.png') 0px -158px no-repeat;
}
.modal.model .modal-header .tabs .tab.ok span:before {
background: url('../images/ok-icon-active.png') 0px 1px no-repeat;
}
.modal.model .modal-header .tabs .tab.ok span:before {
background: url('../images/ok-icon-active.png') 0px 1px no-repeat;
}
.modal.model .tabs .tab .message {
position: absolute;
top: 7px;
left: 18px;
width: 31px;
height: 23px;
padding: 1px 0 0 0px;
margin: 0;
background: url('../images/table-icons.png') 4px -210px no-repeat;
text-align: center;
color: #ec0000;
line-height: 20px;
font-size: 11px;
}
/* Specialists */
.modal.model .modal-form .specialists-panel table td.label {
width: auto;
text-align: left;
}
.modal.model tr .msg-button {
visibility: hidden;
}
.modal.model tr:hover .msg-button, tr .msg-button.active {
visibility: visible;
}
.modal.model .specialist-message textarea {
width: 100%;
height: 80px;
}
.modal.model .specialist-message {
display: none;
}
.modal.model .modal-form table .specialist-message td {
padding-top: 8px;
}
/* Buttons */
.modal.model .buttons {
width: 485px;
margin: 30px auto 0;
}
.modal.model .buttons .link {
margin-top: 15px;
}
.modal.model .buttons .link a {
color: #b41c07;
}
.modal.model .modal-form-button {
width: auto;
padding: 0px 24px;
}
.modal.model .modal-form-button.disabled {
cursor: default;
border: 1px solid #ededed;
background: #e2e2e2;
text-shadow: none;
background: linear-gradient(180deg, #ededed 0%, #d8d8d8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#d8d8d8', GradientType=0);
}
.modal.model .modal-form-delete-file {
display: inline-block;
cursor: pointer;
background: url(../images/delete-icon.png) 0 0px no-repeat;
width: 10px;
height: 10px;
position: relative;
top: 1px;
margin-left: 5px;
}
/* Form */
.modal.model .tab-pane {
position: relative;
}
.modal.model .modal-form {
padding: 38px 20px 30px 20px;
}
.modal.model .modal-form table {
font-size: 13px;
width: 485px;
margin: auto;
}
.modal.model .modal-form table td {
padding: 3px 8px;
vertical-align: middle;
border-top: 1px solid #d6d6d6;
border-bottom: 1px solid #d6d6d6;
height: 41px;
}
.modal.model .modal-form table td.label {
color: #46494a;
font-weight: bold;
width: 227px;
background: #f2f2f2;
}
.modal.model .modal-form .modal-select-wrapper {
margin-bottom: 0px;
font-weight: normal;
color: #5e6d81;
}
.modal.model .modal-form .select .modal-select-dropdown-item {
padding-top: 6px;
height: 24px;
}
.modal.model .modal-form .modal-input-wrapper {
}
.modal.model .modal-form .modal-input-wrapper input {
height: 31px;
font-size: 13px;
color: #5e6d81;
}
.modal.model .modal-form table td.field {
}
.modal.model .modal-form table .value {
font-size: 13px;
color: #5e6d81;
position: relative;
padding: .75em 12px;
border: 1px solid #ced7d9;
border-radius: 4px;
}
.modal.model .modal-form table td.submit {
padding-top: 20px;
}
.modal.model .modal-form table td.submit a {
font-size: 14px;
color: #b51a1a;
}
.modal.model .modal-form-requirements {
color: #828282;
font-size: 12px;
font-weight: bold;
margin-top: 4px;
}
.modal.model .modal-form-info {
color: #555555;
font-size: 12px;
font-weight: bold;
margin-bottom: 6px;
}
.modal.model .type-fields {
display: none;
}
.modal.model form .field .value {
display: none;
}
.modal.model form .field .file .value {
display: inline-block;
}
.modal.model form .field .file .value.file-name {
margin: 5px 0 0;
padding: 0;
border: 0;
overflow: hidden;
text-overflow: ellipsis;
width: 270px;
}
.modal.model form.edit .model-type .input {
display: none;
}
.modal.model form.edit .model-type .value {
display: block;
}
.modal.model form.edit table td.model-type {
}
.modal.model form.edit .number-field .value {
display: block;
}
.modal.model form.accepted .submit {
visibility: hidden;
}
.modal.model form .draft {
display: none;
}
.modal.model form .delete {
display: none;
}
.modal.model form .cancel {
display: none;
}
.modal.model form.edit .draft,
.modal.model form.add .draft {
display: block;
}
.modal.model form.edit .delete {
display: block;
}
.modal.model form.view .submit-btn {
display: none;
}
.modal.model form.view .field .value {
display: block;
}
.modal.model form.view .field .input {
display: none;
}
.modal.model form.view table td.field {
}
.modal.model form.view .cancel {
display: block;
}
.modal.model form.view.accepted .cancel {
display: none;
}
.modal.model form.accepted .submit-btn,
.modal.model form.accepted .draft-btn,
.modal.model form.accepted .delete-btn {
display: none;
}
/* File input */
.modal-file-wrapper .control .modal-form-button {
height: 34px;
width: 34px;
padding: 0;
background: #8dcc97 url('../images/clip-icon4.png') no-repeat center center;
}
.modal-file-wrapper .control:hover .modal-form-button {
background-color: #a0e8ac;
}
.modal-file-wrapper .control {
float: left;
}
.file .file-name {
line-height: 22px;
margin-top: 6px;
margin-left: 10px;
padding: 0 10px;
background: #ededed;
font-size: 12px;
display: inline-block;
max-width: 162px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
form.accepted .file .file-name, form.view .file .file-name {
line-height: inherit;
margin: 0;
padding: 0;
background: none;
max-width: none;
display: inline;
white-space: normal;
overflow: auto;
}
.modal-file-wrapper {
position: relative;
}
.modal-file-wrapper .control .modal-form-button {
display: block;
}
.modal-file-wrapper .control {
position: relative;
overflow: hidden;
width: 34px;
height: 34px;
}
.modal-file-wrapper input {
margin-top: -60px;
margin-left: -410px;
-moz-opacity: 0;
filter: alpha(opacity=0);
opacity: 0;
font-size: 150px;
height: 66px;
position: relative;
z-index: 50;
}
.scroller-wrapper .modal-file-wrapper input {
margin-top: 0px;
margin-left: 0px;
position: absolute;
top: 0px;
left: 0px;
height: auto;
min-height: 500px;
}
.concept-report-file .modal-file-wrapper input {
margin-top: 0px;
margin-left: 0px;
}
.modal-textarea-wrapper textarea {
width: 350px;
height: 200px;
}
.form-loader {
display: block;
margin: 0 auto;
}
#confirm-delete {
display: none;
width: 364px;
margin-left: -182px;
}
.modal-input-group-wrapper .modal-short-input-wrapper {
float: left;
width: 37%;
position: relative;
}
.modal-input-group-wrapper .modal-short-input-wrapper:last-child {
float: right;
}
.model.modal .chat .scroller {
margin-top: 10px;
}
.model.modal .chat .modal-header-search {
display: none;
}
.model.modal .label .sub {
color: #828282;
font-size: 10px;
}
.model.modal .chat .scroller, .model-pane .scroller, .report-pane .scroller {
margin-top: 10px;
}
/* Concept TBD */
#concept-modal .modal-form table {
font-size: 14px;
}
#concept-modal .modal-form table.send-form {
font-size: 12px;
width: 100%;
}
#concept-modal .modal-form table td {
padding: 8px;
vertical-align: top;
padding-top: 21px;
}
#concept-modal .modal-form table td.description {
width: 65%;
font-weight: bold;
padding: 0 30px 0 8px;
}
#concept-modal .modal-form table td.description li {
list-style: disc inside;
font-style: italic;
color: #0078AD;
padding-top: 0;
}
#concept-modal .modal-form table td.form {
font-weight: bold;
padding-top: 0;
padding-bottom: 0;
}
#concept-modal .modal-form table td.label {
text-align: left;
width: auto;
font-weight: bold;
padding: 21px 8px 8px;
vertical-align: top;
}
#concept-modal .modal-form table.send-form td.field {
padding-top: 0;
padding-bottom: 0;
}
#concept-modal .modal-form table td.submit {
text-align: left;
}
#concept-modal .modal-form table.send-form td.submit {
padding-top: 20px;
text-align: center;
}
/* Input messages */
.model.modal form .message {
top: 2px;
padding: 6px 8px;
display: none;
z-index: 999;
}
.model.modal form .modal-select-wrapper .message {
top: -4px;
}
.model.modal form .message:before {
top: 6px;
left: -8px;
border-width: 7px;
}
.model.modal form .message:after {
top: 6px;
left: -7px;
border-width: 7px;
}
.model.modal .concept-form .description {
font-size: 15px;
font-weight: bold;
}
.model.modal .concept-form .requirements {
position: relative;
background: #d1ebd5;
padding: 23px;
margin-bottom: 15px;
}
.model.modal .concept-form .requirements:after {
content: "";
position: absolute;
border-right: 8px solid rgba(255, 255, 255, 0);
border-top: 8px solid #d1ebd5;
border-left: 8px solid rgba(255, 255, 255, 0);
left: 8px;
top: 100%;
}
.model.modal .concept-form .requirements ul {
margin-left: 16px;
}
.model.modal .concept-form .requirements ul li {
list-style: disc;
padding-bottom: 7px;
color: #2f2f2f;
}
.model.modal .concept-form .requirements ul li:last-child {
padding-bottom: 0px;
}
/* agreement info */
.activity .content-wrapper .pane > div.agreement-info {
display: block;
}
.agreement-info {
padding: 2px 10px 0;
float: left;
color: #D2221F;
}
/* nfz overrides */
.modal.model .modal-header {
background: none;
border: 0;
}
.modal.model .modal-header .tabs {
position: relative;
top: 0;
padding-top: 13px;
}
.modal.model .modal-header .tabs .tab {
border-bottom: 0 !important;
}
.modal.model .modal-header .tabs .tab span {
display: block;
height: auto;
line-height: normal;
padding: .75em 20px .5em 50px;
width: auto;
background: none;
font-weight: 700 !important;
min-width: 100px;
text-align: left;
text-shadow: none !important;
}
.modal.model .modal-header .tabs .tab.active span {
color: #fff;
}
.modal.model .tabs .tab .message {
left: 5px;
background: url(../images/icon_comm.png) 0 0 no-repeat;
width: 27px;
height: 25px;
color: #000;
font-size: 12px;
line-height: 22px;
}
.modal.model .modal-form table {
width: 100%;
}
#models-list {
font-size: 11px;
}
#models-list td {
padding-left: 7px;
padding-right: 7px;
}
.dealer-activities-statistics .drop-shadow {
position: relative;
#float: left;
width: 95%;
padding: 1em;
margin: 1em;
background: #fff;
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) , 0 0 40px rgba(0, 0, 0, 0.1) inset;
-mox-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) , 0 0 40px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) , 0 0 40px rgba(0, 0, 0, 0.1) inset;
}
.dealer-activities-statistics .drop-shadow:before,
.dealer-activities-statistics .drop-shadow:after {
content: "";
position: absolute;
z-index: -2;
}
.dealer-activities-statistics .drop-shadow p {
font-size: 12px;
font-weight: bold;
margin-bottom: 3px;
}
.dealer-activities-statistics .perspective:before {
left: 80px;
bottom: 5px;
width: 50%;
height: 35%;
max-width: 200px;
max-height: 20px;
-webkit-box-shadow: -80px 0 8px rgba(0, 0, 0, 0.4);
-mox-box-shadow: -80px 0 8px rgba(0, 0, 0, 0.4);
box-shadow: -80px 0 8px rgba(0, 0, 0, 0.4);
-webkit-transform: skew(50deg);
-moz-transform: skew(50deg);
-ms-transform: skew(50deg);
-o-transform: skew(50deg);
transform: skew(50deg);
-webkit-transform-origin: 0 100%;
-moz-transform-origin: 0 100%;
-ms-transform-origin: 0 100%;
-o-transform-origin: 0 100%;
transform-origin: 0 100%;
}
.dealer-activities-statistics .perspective:after {
display: none;
}
| 19.576869 | 123 | 0.639049 |
1cb91cc036eb8a5cd670e25c4e8090b35dc0a75d
| 4,579 |
css
|
CSS
|
public/css/common.css
|
Okamo612/atte
|
a36345e4f19374ed040b91a2eee04b8831a58f73
|
[
"MIT"
] | null | null | null |
public/css/common.css
|
Okamo612/atte
|
a36345e4f19374ed040b91a2eee04b8831a58f73
|
[
"MIT"
] | null | null | null |
public/css/common.css
|
Okamo612/atte
|
a36345e4f19374ed040b91a2eee04b8831a58f73
|
[
"MIT"
] | null | null | null |
@charset "UTF-8";
/*ヘッダー、フッター、コンポーネントをまとめてcommon.cssにコンパイル・出力する*/
/*内容の被る部分が多かったlogin,registerについてもこちらに記載*/
/*---------------header---------------*/
header {
background-color: white;
height: 40px;
padding: 20px 30px;
display: flex;
justify-content: space-between;
align-items: center;
/*スマホサイズでハンバーガーメニュー*/
}
header .logo {
font-size: 24px;
font-weight: 900;
}
header nav {
display: flex;
}
header nav .header-nav-item a {
margin-left: 40px;
font-size: 15px;
color: black;
font-weight: bold;
text-decoration: none;
}
header .nav-w480 {
display: none;
}
@media screen and (max-width: 480px) {
header .header-nav {
display: none;
}
header .nav-w480 {
display: block;
}
header .nav-w480 #menubtn {
margin-right: 10px;
height: 50px;
width: 50px;
}
header .nav-w480 #nav-input {
display: none;
}
header .nav-w480 .nav-hidden {
display: none;
}
header .nav-w480 .header-nav-w480 {
display: none;
position: fixed;
right: 5px;
}
header .nav-w480 .header-nav-w480 .header-nav-ul {
width: 170px;
height: 200px;
border: 1px solid darkgray;
border-radius: 5px;
padding-left: 10px;
background-color: rgb(255, 255, 255);
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: space-around;
}
header .nav-w480 .header-nav-w480 .header-nav-item a {
font-size: 24px;
margin: 8px;
font-weight: normal;
}
header .nav-w480 #nav-input:checked ~ nav {
display: block;
z-index: 1000;
-webkit-animation: 1s fadeIn;
animation: 1s fadeIn;
}
@-webkit-keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
@keyframes fadeIn {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
}
/*---------------footer---------------*/
.footer {
left: 0;
position: fixed;
bottom: 0;
width: 100%;
height: 25px;
padding: 15px 0px;
text-align: center;
background-color: #ffffff;
font-weight: 800;
font-size: 16px;
color: black;
}
/*---------------body---------------*/
body {
background-color: #ebebeb;
width: 100%;
height: 100%;
flex-direction: column;
text-align: center;
}
ul {
display: flex;
list-style: none;
}
.contents {
padding: 6vh 8vw;
height: calc(75vh - 65px);
}
@media screen and (max-width: 768px) {
.contents {
padding-left: 2vw;
padding-right: 2vw;
}
}
.content-ttl {
font-size: 24px;
font-weight: bold;
}
.flash_msg {
margin: 5px;
height: 15px;
font-size: 14px;
display: inline-block;
color: red;
}
/*---------------register,login---------------*/
.form {
padding: 5px;
}
.form-element {
margin: 8px 0 8px 0;
}
.form-element .form-input {
margin-bottom: 10px;
width: 300px;
border-radius: 4px;
border: 2px solid #909090;
padding: 10px;
font-size: 14px;
background-color: #f5f5f5;
}
@media screen and (max-width: 480px) {
.form-element .form-input {
width: 60vw;
}
}
.guidance {
font-size: 12px;
}
.guidance .guidance-msg {
color: #909090;
margin: 5px;
}
.guidance a {
text-decoration: none;
color: blue;
}
/*---------------components--------------*/
/*---------------打刻ボタン---------------*/
.btn_stamp {
width: 100%;
height: 100%;
font-size: 24px;
color: black;
border-radius: 6px;
border: 0px;
border-color: #999999;
background-color: white;
cursor: pointer;
}
.btn_stamp[name=stamp_ng] {
color: gray;
background-color: #999999;
cursor: default;
}
/*---------------登録・ログインボタン---------------*/
#btn_post {
width: 300px;
font-size: 18px;
color: #fff;
margin-bottom: 20px;
padding: 5px 0;
border-radius: 8px;
border: 2px solid #214be0;
background-color: #214be0;
cursor: pointer;
}
@media screen and (max-width: 480px) {
#btn_post {
width: 60vw;
}
}
/*---------------pagination---------------*/
.pagination {
margin-top: 10px;
display: flex;
justify-content: center;
}
.pagination li {
background-color: white;
font-size: 20px;
width: 50px;
height: 40px;
display: flex;
align-items: normal;
border-collapse: collapse;
border: 1px solid #ebebeb;
}
.pagination li span {
width: 100%;
line-height: 40px;
text-align: center;
background-color: #00a2ff;
color: white;
}
.pagination li a {
width: 100%;
line-height: 40px;
text-decoration: none;
color: #00a2ff;
}
.paginate_link_sp {
display: none;
}
@media screen and (max-width: 480px) {
.paginate_link_default {
display: none;
}
.paginate_link_sp {
display: block;
}
}
| 17.344697 | 56 | 0.59489 |
b2b7e4ac8602126a7252025c382dc07c1f558b19
| 1,181 |
py
|
Python
|
fabrikApi/views/assembly/list.py
|
demokratiefabrik/fabrikApi
|
a56bb57d59a5e7cbbeeb77889c02d82f2a04c682
|
[
"MIT"
] | null | null | null |
fabrikApi/views/assembly/list.py
|
demokratiefabrik/fabrikApi
|
a56bb57d59a5e7cbbeeb77889c02d82f2a04c682
|
[
"MIT"
] | null | null | null |
fabrikApi/views/assembly/list.py
|
demokratiefabrik/fabrikApi
|
a56bb57d59a5e7cbbeeb77889c02d82f2a04c682
|
[
"MIT"
] | null | null | null |
""" Assemblies List View. """
import logging
from datetime import datetime
from cornice.service import Service
from fabrikApi.models.assembly import DBAssembly
from fabrikApi.models.mixins import arrow
# from fabrikApi.util.cors import CORS_LOCATION, CORS_MAX_AGE
logger = logging.getLogger(__name__)
# SERVICES
assemblies = Service(cors_origins=('*',),
name='assemblies',
description='List Assemblies.',
path='/assemblies')
@assemblies.get(permission='public')
def get_assemblies(request):
"""Returns all assemblies which are either public or accessible by the current user.
"""
# load all active assemblies
# TODO: filter only active assemblies
assemblies = request.dbsession.query(DBAssembly).all()
for assembly in assemblies:
# assembly.patch()
assembly.setup_lineage(request)
# show only assemblies with at least view permission.
assemblies = list(
filter(lambda assembly: request.has_public_permission(assembly),
assemblies)
)
assemblies = {v.identifier: v for v in assemblies}
return({
'assemblies': assemblies,
'access_date': arrow.utcnow()
})
| 25.673913 | 88 | 0.702794 |
bcb19da65b166034fbf4dcb08980de5b6f4282a9
| 505 |
js
|
JavaScript
|
src/renderer/converter.js
|
firemiles/Snippets
|
0d009da668efe73acb0e773a65beccf372026f27
|
[
"MIT"
] | null | null | null |
src/renderer/converter.js
|
firemiles/Snippets
|
0d009da668efe73acb0e773a65beccf372026f27
|
[
"MIT"
] | null | null | null |
src/renderer/converter.js
|
firemiles/Snippets
|
0d009da668efe73acb0e773a65beccf372026f27
|
[
"MIT"
] | null | null | null |
import languages from './assets/data/languages';
const converter = {
languageToExtension(language) {
if (languages.filter(l => l.name === language).length > 0) {
return languages.filter(l => l.name === language)[0].extension;
}
return 'txt';
},
extensionToLanguage(extension) {
if (languages.filter(l => l.extension === extension).length > 0) {
return languages.filter(l => l.extension === extension)[0].name;
}
return 'text';
},
};
export default converter;
| 26.578947 | 70 | 0.635644 |
0c9bc7001e74f0f6fcfe78268989e2e0da68dfe9
| 884 |
sql
|
SQL
|
db/computer/jeesite_cms_guestbook.sql
|
WDoubleQ/computer
|
2aec24a1d0397e69e2c60dbadfd93b65ec1fccf0
|
[
"Apache-2.0"
] | 1 |
2020-04-25T11:37:17.000Z
|
2020-04-25T11:37:17.000Z
|
db/computer/jeesite_cms_guestbook.sql
|
WDoubleQ/computer
|
2aec24a1d0397e69e2c60dbadfd93b65ec1fccf0
|
[
"Apache-2.0"
] | null | null | null |
db/computer/jeesite_cms_guestbook.sql
|
WDoubleQ/computer
|
2aec24a1d0397e69e2c60dbadfd93b65ec1fccf0
|
[
"Apache-2.0"
] | null | null | null |
create table cms_guestbook
(
id varchar(64) not null comment '编号'
primary key,
type char not null comment '留言分类',
content varchar(255) not null comment '留言内容',
name varchar(100) not null comment '姓名',
email varchar(100) not null comment '邮箱',
phone varchar(100) not null comment '电话',
workunit varchar(100) not null comment '单位',
ip varchar(100) not null comment 'IP',
create_date datetime not null comment '留言时间',
re_user_id varchar(64) null comment '回复人',
re_date datetime null comment '回复时间',
re_content varchar(100) null comment '回复内容',
del_flag char default '0' not null comment '删除标记'
)
comment '留言板' charset = utf8;
create index cms_guestbook_del_flag
on cms_guestbook (del_flag);
| 38.434783 | 57 | 0.595023 |
5fef6388718e63efd88619a5405aa8444401a121
| 94 |
css
|
CSS
|
src/app/components/error-summary/error-summary.component.css
|
VladimirN/ang2-course
|
ba5f2ece4c9c55da5c3b90c6997e760ec937b49c
|
[
"MIT"
] | null | null | null |
src/app/components/error-summary/error-summary.component.css
|
VladimirN/ang2-course
|
ba5f2ece4c9c55da5c3b90c6997e760ec937b49c
|
[
"MIT"
] | null | null | null |
src/app/components/error-summary/error-summary.component.css
|
VladimirN/ang2-course
|
ba5f2ece4c9c55da5c3b90c6997e760ec937b49c
|
[
"MIT"
] | null | null | null |
.error-summary {
border: 1px solid red;
}
.error-summary li {
text-transform: uppercase;
}
| 11.75 | 27 | 0.691489 |
9c206de424831909c285e68228bc188cf68f5884
| 8,393 |
js
|
JavaScript
|
sources/js/ViewStates.js
|
heschel6/Magic_Experiment
|
ceb8b81e7bcb210cc9f1775323f6afe4da6bdbb1
|
[
"MIT"
] | 201 |
2016-11-14T23:13:21.000Z
|
2019-04-17T19:55:12.000Z
|
sources/js/ViewStates.js
|
heschel6/Magic_Experiment
|
ceb8b81e7bcb210cc9f1775323f6afe4da6bdbb1
|
[
"MIT"
] | 10 |
2016-12-23T06:06:23.000Z
|
2021-04-19T21:04:55.000Z
|
sources/js/ViewStates.js
|
heschel6/Magic_Experiment
|
ceb8b81e7bcb210cc9f1775323f6afe4da6bdbb1
|
[
"MIT"
] | 19 |
2016-12-23T10:08:35.000Z
|
2021-08-16T08:08:22.000Z
|
var ViewStates, ViewStatesIgnoredKeys,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__slice = [].slice;
ViewStatesIgnoredKeys = ["ignoreEvent"];
ViewStates = (function(_super) {
__extends(ViewStates, _super);
function ViewStates(view) {
this.view = view;
this._states = {};
this._orderedStates = [];
this.animationOptions = {};
this._currentState = "default";
this._previousStates = [];
this.add("default", this.view.props);
ViewStates.__super__.constructor.apply(this, arguments);
}
ViewStates.prototype.add = function(stateName, properties) {
var error, k, v;
if (Utils.isObject(stateName)) {
for (k in stateName) {
v = stateName[k];
this.add(k, v);
}
return;
}
error = function() {
throw Error("Usage example: view.states.add(\"someName\", {x:500})");
};
if (!Utils.isString(stateName)) {
error();
}
if (!Utils.isObject(properties)) {
error();
}
this._orderedStates.push(stateName);
return this._states[stateName] = ViewStates.filterStateProperties(properties);
};
ViewStates.prototype.remove = function(stateName) {
if (!this._states.hasOwnProperty(stateName)) {
return;
}
delete this._states[stateName];
return this._orderedStates = Utils.without(this._orderedStates, stateName);
};
ViewStates.prototype["switch"] = function(stateName, animationOptions, instant) {
var animatablePropertyKeys, animatingKeys, args, callback, k, properties, propertyName, v, value, _ref, _ref1;
if (instant == null) {
instant = false;
}
args = arguments;
callback = NULL;
if (Utils.isFunction(arguments[1])) {
callback = arguments[1];
} else if (Utils.isFunction(arguments[2])) {
callback = arguments[2];
} else if (Utils.isFunction(arguments[3])) {
callback = arguments[3];
}
if (!this._states.hasOwnProperty(stateName)) {
throw Error("No such state: '" + stateName + "'");
}
this.emit(Event.StateWillSwitch, this._currentState, stateName, this);
this._previousStates.push(this._currentState);
this._currentState = stateName;
properties = {};
animatingKeys = this.animatingKeys();
_ref = this._states[stateName];
for (propertyName in _ref) {
value = _ref[propertyName];
if (__indexOf.call(ViewStatesIgnoredKeys, propertyName) >= 0) {
continue;
}
if (__indexOf.call(animatingKeys, propertyName) < 0) {
continue;
}
if (Utils.isFunction(value)) {
value = value.call(this.view, this.view, propertyName, stateName);
}
properties[propertyName] = value;
}
animatablePropertyKeys = [];
for (k in properties) {
v = properties[k];
if (Utils.isNumber(v)) {
animatablePropertyKeys.push(k);
} else if (Color.isColorObject(v)) {
animatablePropertyKeys.push(k);
} else if (v === null) {
animatablePropertyKeys.push(k);
}
}
if (animatablePropertyKeys.length === 0) {
instant = true;
}
if (instant === true) {
this.view.props = properties;
return this.emit(Event.StateDidSwitch, Utils.last(this._previousStates), this._currentState, this);
} else {
if (animationOptions == null) {
animationOptions = this.animationOptions;
}
animationOptions.properties = properties;
if ((_ref1 = this._animation) != null) {
_ref1.stop();
}
this._animation = this.view.animate(animationOptions);
return this._animation.once("stop", (function(_this) {
return function() {
for (k in properties) {
v = properties[k];
if (!(Utils.isNumber(v) || Color.isColorObject(v))) {
_this.view[k] = v;
}
}
if (callback) {
callback(Utils.last(_this._previousStates), _this._currentState, _this);
}
if (Utils.last(_this._previousStates) !== stateName) {
return _this.emit(Event.StateDidSwitch, Utils.last(_this._previousStates), _this._currentState, _this);
}
};
})(this));
}
};
ViewStates.prototype.switchInstant = function(stateName, callback) {
return this["switch"](stateName, null, true, callback);
};
ViewStates.define("state", {
get: function() {
return this._currentState;
}
});
ViewStates.define("current", {
get: function() {
return this._currentState;
}
});
ViewStates.define("all", {
get: function() {
return Utils.clone(this._orderedStates);
}
});
ViewStates.prototype.states = function() {
return Utils.clone(this._orderedStates);
};
ViewStates.prototype.animatingKeys = function() {
var keys, state, stateName, _ref;
keys = [];
_ref = this._states;
for (stateName in _ref) {
state = _ref[stateName];
keys = Utils.union(keys, Utils.keys(state));
}
return keys;
};
ViewStates.prototype.previous = function(states, animationOptions) {
var args, callback, last;
args = arguments;
last = Utils.last(args);
callback = NULL;
if (Utils.isFunction(last)) {
args = Array.prototype.slice.call(arguments);
callback = args.pop();
if (states === callback) {
states = NULL;
}
if (animationOptions === callback) {
animationOptions = {};
}
}
if (states == null) {
states = this.states();
}
return this["switch"](Utils.arrayPrev(states, this._currentState), animationOptions, callback);
};
ViewStates.prototype.next = function() {
var args, callback, index, last, states, that;
args = arguments;
last = Utils.last(args);
callback = NULL;
that = this;
if (Utils.isFunction(last)) {
args = Array.prototype.slice.call(arguments);
callback = args.pop();
}
states = Utils.arrayFromArguments(args);
if (!states.length) {
states = this.states();
index = states.indexOf(this._currentState);
if (index + 1 > states.length) {
states = [states[0]];
} else {
states = [states[index + 1]];
}
}
return this["switch"](Utils.arrayNext(states, this._currentState), function() {
states.shift();
if (states.length > 0) {
if (callback) {
return that.next(states, callback);
} else {
return that.next(states);
}
} else if (callback) {
return callback();
}
});
};
ViewStates.prototype.last = function(animationOptions) {
var args, callback, last, state;
args = arguments;
last = Utils.last(args);
callback = NULL;
state = NULL;
if (Utils.isFunction(last)) {
args = Array.prototype.slice.call(arguments);
callback = args.pop();
if (animationOptions === callback) {
animationOptions = {};
}
}
if (!this._previousStates.length) {
state = this.states();
} else {
state = this._previousStates;
}
return this["switch"](Utils.last(state), animationOptions, callback);
};
ViewStates.prototype.emit = function() {
var args, _ref;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
ViewStates.__super__.emit.apply(this, arguments);
return (_ref = this.view).emit.apply(_ref, args);
};
ViewStates.filterStateProperties = function(properties) {
var k, stateProperties, v;
stateProperties = {};
for (k in properties) {
v = properties[k];
if (Utils.isString(v) && Utils.endsWith(k.toLowerCase(), "color") && Color.isColorString(v)) {
stateProperties[k] = new Color(v);
} else if (Utils.isNumber(v) || Utils.isFunction(v) || Utils.isBoolean(v) || Utils.isString(v) || Color.isColorObject(v) || v === null) {
stateProperties[k] = v;
}
}
return stateProperties;
};
return ViewStates;
})(Element);
| 30.97048 | 290 | 0.608245 |
a05c762ea772a9aa5351f0d002e969ba7ba3c566
| 354 |
sql
|
SQL
|
zs_m_3_scripts/M3_L5_ALTER.sql
|
morb1d/zrozumsql
|
cde4597a8e5c466551f45740039f9ed7038f314f
|
[
"MIT"
] | 1 |
2020-09-23T18:07:05.000Z
|
2020-09-23T18:07:05.000Z
|
zs_m_3_scripts/M3_L5_ALTER.sql
|
morb1d/zrozumsql
|
cde4597a8e5c466551f45740039f9ed7038f314f
|
[
"MIT"
] | null | null | null |
zs_m_3_scripts/M3_L5_ALTER.sql
|
morb1d/zrozumsql
|
cde4597a8e5c466551f45740039f9ed7038f314f
|
[
"MIT"
] | 5 |
2020-11-05T11:57:37.000Z
|
2021-09-22T08:09:54.000Z
|
CREATE SCHEMA trainig;
ALTER SCHEMA trainig RENAME TO training;
CREATE TABLE new_table (id integer);
ALTER TABLE new_table RENAME TO newer_table;
ALTER TABLE newer_table
ADD COLUMN description TEXT;
ALTER TABLE newer_table
RENAME description TO descr;
ALTER TABLE newer_table
DROP descr;
ALTER TABLE newer_table
DROP id;
| 18.631579 | 46 | 0.754237 |
0ffc26abacde359e138a8ee20c398cf430a6f014
| 2,219 |
swift
|
Swift
|
___SwiftUI-Sandbox/SwiftUI-Pure-SwiftUI/Sources/PureSwiftUI/Extensions/Convenience/SwiftUI/Angle+Convenience.swift
|
luannguyen252/my-swift-journey
|
788d66f256358dc5aefa2f3093ef74fd572e83b3
|
[
"MIT"
] | 14 |
2020-12-09T08:53:39.000Z
|
2021-12-07T09:15:44.000Z
|
___SwiftUI-Sandbox/SwiftUI-Pure-SwiftUI/Sources/PureSwiftUI/Extensions/Convenience/SwiftUI/Angle+Convenience.swift
|
luannguyen252/my-swift-journey
|
788d66f256358dc5aefa2f3093ef74fd572e83b3
|
[
"MIT"
] | null | null | null |
___SwiftUI-Sandbox/SwiftUI-Pure-SwiftUI/Sources/PureSwiftUI/Extensions/Convenience/SwiftUI/Angle+Convenience.swift
|
luannguyen252/my-swift-journey
|
788d66f256358dc5aefa2f3093ef74fd572e83b3
|
[
"MIT"
] | 8 |
2020-12-10T05:59:26.000Z
|
2022-01-03T07:49:21.000Z
|
//
// Angle+Convenience.swift
//
//
// Created by Adam Fordyce on 20/11/2019.
// Copyright © 2019 Adam Fordyce. All rights reserved.
//
import SwiftUI
public extension Angle {
static func *<T: UINumericType>(lhs: Angle, rhs: T) -> Angle {
Angle(degrees: lhs.degrees * rhs.asDouble)
}
static func /<T: UINumericType>(lhs: Angle, rhs: T) -> Angle {
Angle(degrees: lhs.degrees / rhs.asDouble)
}
}
// MARK: ----- TRIGONOMETRY
public extension Angle {
var cos: Double {
Darwin.cos(self.radians)
}
var sin: Double {
Darwin.sin(self.radians)
}
var tan: Double {
Darwin.tan(self.radians)
}
}
// MARK: ----- COORDINATES
public extension Angle {
static let topLeading = 315.degrees
static let top = 0.degrees
static let topTrailing = 45.degrees
static let trailing = 90.degrees
static let bottomTrailing = 135.degrees
static let bottom = 180.degrees
static let bottomLeading = 225.degrees
static let leading = 270.degrees
}
// MARK: ----- CYCLE FRACTION
public extension Angle {
static func cycle<T: UINumericType>(_ scale: T) -> Angle {
(360.0 * scale.asDouble).degrees
}
}
// MARK: ----- UNIT POINT CONVERSION
private let maxUnitRadius = sqrt(0.5 * 0.5 + 0.5 * 0.5)
private let unitPointForNamedAngle: [Angle: UnitPoint] = [
.topLeading: .topLeading,
.top: .top,
.topTrailing: .topTrailing,
.trailing: .trailing,
.bottomTrailing: .bottomTrailing,
.bottom: .bottom,
.bottomLeading: .bottomLeading,
.leading: .leading,
]
public extension Angle {
var asUnitPoint: UnitPoint {
if let unitPoint = unitPointForNamedAngle[self] {
return unitPoint
} else {
var offset = calcOffset(radius: maxUnitRadius, angle: self)
if abs(offset.x) > 0.5 {
let ratio = 0.5 / abs(offset.x)
offset = offset.scaled(ratio)
} else if abs(offset.y) > 0.5 {
let ratio = 0.5 / abs(offset.y)
offset = offset.scaled(ratio)
}
return offset.offset(.point(0.5, 0.5)).asUnitPoint
}
}
}
| 23.114583 | 71 | 0.592609 |
12b07c93e2f23fafb3e829fbbc2440bb27dbc592
| 3,658 |
h
|
C
|
generalScheduler/RequestScheduler_RR.h
|
uwuser/MCsim
|
df0033e73aa7669fd89bc669ff25a659dbb253f6
|
[
"MIT"
] | 1 |
2021-11-25T20:09:08.000Z
|
2021-11-25T20:09:08.000Z
|
generalScheduler/RequestScheduler_RR.h
|
uwuser/MCsim
|
df0033e73aa7669fd89bc669ff25a659dbb253f6
|
[
"MIT"
] | 1 |
2021-11-03T21:15:53.000Z
|
2021-11-04T15:53:20.000Z
|
generalScheduler/RequestScheduler_RR.h
|
uwuser/MCsim
|
df0033e73aa7669fd89bc669ff25a659dbb253f6
|
[
"MIT"
] | 1 |
2020-11-25T14:09:30.000Z
|
2020-11-25T14:09:30.000Z
|
#ifndef REQUESTSCHEDULER_RR_H
#define REQUESTSCHEDULER_RR_H
#include <queue>
#include "../src/RequestScheduler.h"
namespace MCsim
{
class RequestScheduler_RR : public RequestScheduler
{
private:
unsigned int slotCounter, timeSlot, dataBusSize;
unsigned int queueIndex; // Check order of queue index
std::vector<unsigned> queueRequestorIndex; // Requestor queue index in individual memory level
std::vector<Request *> srtRequestBuffer;
bool fixedPrioirty;
public:
RequestScheduler_RR(std::vector<RequestQueue *> &requestQueues, std::vector<CommandQueue *> &commandQueues, const std::map<unsigned int, bool> &requestorTable, int dataBus) : RequestScheduler(requestQueues, commandQueues, requestorTable)
{
// The time slot must be calculated based on the device and pattern
// ex.DDR3-1600H: RCD + WL + Bus + WR + RP = 42
// request scheduler picks a request at each timeslot and then move to the next requestor based on the RR arbitration
fixedPrioirty = false;
slotCounter = 0;
dataBusSize = dataBus;
timeSlot = 42;
queueIndex = 0;
for (unsigned int index = 0; index < requestQueue.size(); index++)
{
queueRequestorIndex.push_back(0);
}
}
void requestSchedule()
{
if (slotCounter == 0)
{
scheduledRequest = NULL;
for (unsigned int index = 0; index < requestQueue.size(); index++)
{
if (requestQueue[queueIndex]->isPerRequestor())
{
if (requestQueue[queueIndex]->getQueueSize() > 0)
{
for (unsigned int subIndex = 0; subIndex < requestQueue[queueIndex]->getQueueSize(); subIndex++)
{
if (requestQueue[queueIndex]->getSize(true, queueRequestorIndex[queueIndex]) > 0)
{
scheduledRequest = requestQueue[queueIndex]->getRequest(queueRequestorIndex[queueIndex], 0);
}
if (scheduledRequest != NULL)
{
if (fixedPrioirty == true)
{
if (requestorCriticalTable.at(scheduledRequest->requestorID) == false)
{
srtRequestBuffer.push_back(scheduledRequest);
requestQueue[queueIndex]->removeRequest();
scheduledRequest = NULL;
}
}
}
if (scheduledRequest != NULL)
{
if (isSchedulable(scheduledRequest, false))
{
requestQueue[index]->removeRequest();
}
else
{
break;
}
}
queueRequestorIndex[queueIndex]++; // Update to next requestor
if (queueRequestorIndex[queueIndex] == requestQueue[queueIndex]->getQueueSize())
{
queueRequestorIndex[queueIndex] = 0;
}
if (scheduledRequest != NULL)
{
break;
}
}
if (scheduledRequest == NULL)
{
if (fixedPrioirty == true && !srtRequestBuffer.empty())
{
if (isSchedulable(srtRequestBuffer.front(), false))
{
srtRequestBuffer.erase(srtRequestBuffer.begin());
}
}
}
}
}
else
{
if (requestQueue[queueIndex]->getSize(false, 0) > 0)
{
scheduledRequest = requestQueue[queueIndex]->getRequest(0);
if (isSchedulable(scheduledRequest, false))
{
requestQueue[index]->removeRequest();
}
}
}
queueIndex++;
if (queueIndex == requestQueue.size())
{
queueIndex = 0;
}
if (scheduledRequest != NULL)
{
slotCounter = timeSlot - 1;
break;
}
}
}
else
{
if (slotCounter > 0)
{
slotCounter--;
}
}
}
};
} // namespace MCsim
#endif /* REQUESTSCHEDULER_RR_H */
| 27.096296 | 239 | 0.603609 |
16c2a74b8fc3f66f068acbca45de861dac36220f
| 318 |
h
|
C
|
BWTransitions/BWTransitions/BWPop/BWPopTransitionDelegate.h
|
baiwhte/BWTransitions
|
48d65a66b11bf59b80dee15ba0eec36c47436dd2
|
[
"MIT"
] | null | null | null |
BWTransitions/BWTransitions/BWPop/BWPopTransitionDelegate.h
|
baiwhte/BWTransitions
|
48d65a66b11bf59b80dee15ba0eec36c47436dd2
|
[
"MIT"
] | null | null | null |
BWTransitions/BWTransitions/BWPop/BWPopTransitionDelegate.h
|
baiwhte/BWTransitions
|
48d65a66b11bf59b80dee15ba0eec36c47436dd2
|
[
"MIT"
] | null | null | null |
//
// BWPopTransitionDelegate.h
// BWTransitions
//
// Created by 陈修武 on 2017/5/10.
// Copyright © 2017年 baiwhte. All rights reserved.
//
@import UIKit;
@interface BWPopTransitionDelegate : NSObject<UINavigationControllerDelegate>
@property (nonatomic, strong) UIPanGestureRecognizer *gestureRecognizer;
@end
| 18.705882 | 77 | 0.761006 |
1850633c6cf1030d5621021614c87de3dae4fccd
| 75 |
rb
|
Ruby
|
app/admin/bank.rb
|
playpark777/spafac-test
|
5ef12ff502adbcf38699cffc1f038b87705d80f4
|
[
"MIT"
] | null | null | null |
app/admin/bank.rb
|
playpark777/spafac-test
|
5ef12ff502adbcf38699cffc1f038b87705d80f4
|
[
"MIT"
] | null | null | null |
app/admin/bank.rb
|
playpark777/spafac-test
|
5ef12ff502adbcf38699cffc1f038b87705d80f4
|
[
"MIT"
] | null | null | null |
ActiveAdmin.register Bank do
permit_params :name, :code, :available
end
| 15 | 40 | 0.773333 |
74bc10f34774c3ba1d6ab4afba1574519382fcb4
| 686 |
js
|
JavaScript
|
experimental/language/$_COOKIE.js
|
VicAMMON/phpjs
|
0f7a89437869393c132f052371ae593d98cbe7f9
|
[
"MIT"
] | 73 |
2017-05-26T10:51:06.000Z
|
2022-03-25T22:13:37.000Z
|
experimental/language/$_COOKIE.js
|
VicAMMON/phpjs
|
0f7a89437869393c132f052371ae593d98cbe7f9
|
[
"MIT"
] | 1 |
2021-11-21T10:54:25.000Z
|
2021-11-21T10:54:25.000Z
|
experimental/language/$_COOKIE.js
|
VicAMMON/phpjs
|
0f7a89437869393c132f052371ae593d98cbe7f9
|
[
"MIT"
] | 20 |
2016-08-20T01:44:09.000Z
|
2021-08-23T14:08:10.000Z
|
function $_COOKIE(name) {
// http://kevin.vanzonneveld.net
// + original by: http://www.quirksmode.org/js/cookies.html
// + improved by: Steve
// + improved by: Brett Zamir (http://brett-zamir.me)
// * example 1: document.cookie = 'test=hello';
// * example 1: var $myVar = $_COOKIE('test'); // Note the round brackets!
// * returns 1: 'hello'
var i = 0, c = '', nameEQ = name + '=',
ca = document.cookie.split(';'),
cal = ca.length;
for (i = 0; i < cal; i++) {
c = ca[i].replace(/^ */, '');
if (c.indexOf(nameEQ) === 0) {
return decodeURIComponent(c.slice(nameEQ.length).replace(/\+/g, '%20'));
}
}
return null;
}
| 32.666667 | 80 | 0.548105 |
3b12151316e7ab6485e95a51c8c10b6af8b184e7
| 3,799 |
h
|
C
|
src/coreds/util.h
|
fbsgen/coreds
|
516e106d019fdc79253dc22593d68a0047cb28d9
|
[
"Apache-2.0"
] | null | null | null |
src/coreds/util.h
|
fbsgen/coreds
|
516e106d019fdc79253dc22593d68a0047cb28d9
|
[
"Apache-2.0"
] | null | null | null |
src/coreds/util.h
|
fbsgen/coreds
|
516e106d019fdc79253dc22593d68a0047cb28d9
|
[
"Apache-2.0"
] | null | null | null |
#pragma once
#include <cstring>
#include <string>
#include <chrono>
namespace coreds {
template <typename T>
struct HasState
{
virtual void update(T state) = 0;
};
namespace util {
const char* const DEFAULT_HOST = "127.0.0.1";
const char* resolveIpPort(char* arg, int* port)
{
if (arg == nullptr)
{
return DEFAULT_HOST;
}
char* colon = std::strchr(arg, ':');
if (colon == nullptr)
{
return arg;
}
if (':' == *arg)
{
// assume local host
*port = std::atoi(arg + 1);
return DEFAULT_HOST;
}
*(colon++) = '\0';
*port = std::atoi(colon);
return arg;
}
const char* resolveEndpoint(char* arg, int* port, bool* secure)
{
if (arg == nullptr)
{
*secure = false;
return DEFAULT_HOST;
}
char* slash = std::strchr(arg, '/');
if (slash == nullptr)
{
*secure = false;
return resolveIpPort(arg, port);
}
if (':' != *(slash - 1))
{
// expect a trailing slash
if ('\0' != *(slash + 1))
return nullptr;
*secure = false;
*slash = '\0';
return resolveIpPort(arg, port);
}
if ('/' != *(slash + 1))
{
// expecting ://
return nullptr;
}
*secure = 's' == *(slash - 2);
arg = slash + 2;
return resolveIpPort(arg, port);
}
static constexpr uint64_t SECONDS_IN_MINUTE = 60;
static constexpr uint64_t SECONDS_IN_HOUR = SECONDS_IN_MINUTE * 60;
static constexpr uint64_t SECONDS_IN_DAY = SECONDS_IN_HOUR * 24;
static constexpr uint64_t SECONDS_IN_MONTH = SECONDS_IN_DAY * 30;
static constexpr uint64_t SECONDS_IN_YEAR = SECONDS_IN_DAY * 365;
static constexpr uint64_t SECONDS_IN_WEEK = SECONDS_IN_DAY * 7;
static int appendTo(std::string& str, int seconds, int count,
const std::string& singular,
const std::string& plural = "")
{
long r = static_cast<unsigned>(seconds) / count;
if (!r)
return seconds;
if (!str.empty() && str[str.length() -1] != '-')
str += ", ";
str += std::to_string(r);
str += ' ';
if (r < 2)
{
str += singular;
}
else if (plural.empty())
{
str += singular;
str += 's';
}
else
{
str += plural;
}
return static_cast<unsigned>(seconds) % count;
}
inline int64_t now()
{
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count();
}
void appendTimeagoTo(std::string& str, uint64_t ts,
int64_t now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count())
{
size_t prev = str.size();
int64_t diff = now - ts;
if (diff == 0)
{
str += "just moments ago";
return;
}
int seconds = diff / 1000;
if (seconds < 0)
seconds = -seconds;
// TODO: l10n i18n?
if (-1 != (seconds = appendTo(str, seconds, SECONDS_IN_YEAR, "year")) && str.empty() &&
-1 != (seconds = appendTo(str, seconds, SECONDS_IN_MONTH, "month")) && str.empty() &&
-1 != (seconds = appendTo(str, seconds, SECONDS_IN_WEEK, "week")) && str.empty() &&
-1 != (seconds = appendTo(str, seconds, SECONDS_IN_DAY, "day")) && str.empty() &&
-1 != (seconds = appendTo(str, seconds, SECONDS_IN_HOUR, "hour")) && str.empty() &&
-1 != (seconds = appendTo(str, seconds, SECONDS_IN_MINUTE, "minute")) && str.empty())
{
appendTo(str, seconds, 1, "second");
}
if (prev == str.size())
str += "just moments ago";
else if (diff < 0)
str += " from now";
else
str += " ago";
}
} // util
} // coreds
| 23.596273 | 133 | 0.54646 |
17b76d72d626b7bc10b41f2b341aaeac372fd907
| 176 |
sql
|
SQL
|
migrations/0002-swim-mandatory.sql
|
x15587953/Haskellform
|
d6a7607c41d00495fc155d903ada5d41c998b1d6
|
[
"BSD-3-Clause"
] | 9 |
2018-02-09T15:55:01.000Z
|
2018-05-25T01:07:31.000Z
|
migrations/0002-swim-mandatory.sql
|
x15587953/Haskellform
|
d6a7607c41d00495fc155d903ada5d41c998b1d6
|
[
"BSD-3-Clause"
] | null | null | null |
migrations/0002-swim-mandatory.sql
|
x15587953/Haskellform
|
d6a7607c41d00495fc155d903ada5d41c998b1d6
|
[
"BSD-3-Clause"
] | null | null | null |
UPDATE registration SET swim = FALSE WHERE swim IS NULL;
ALTER TABLE registration ALTER COLUMN swim SET DEFAULT FALSE;
ALTER TABLE registration ALTER COLUMN swim SET NOT NULL;
| 44 | 61 | 0.818182 |
170ece534dde0f4315c4235cc0ef70132fa16108
| 767 |
h
|
C
|
sw_spi.h
|
shuichitakano/fmsx210
|
01fe049021afd16d331cfea13afb27956b8db568
|
[
"MIT"
] | 10 |
2019-10-25T11:54:42.000Z
|
2021-06-06T11:01:05.000Z
|
sw_spi.h
|
shuichitakano/fmsx210
|
01fe049021afd16d331cfea13afb27956b8db568
|
[
"MIT"
] | null | null | null |
sw_spi.h
|
shuichitakano/fmsx210
|
01fe049021afd16d331cfea13afb27956b8db568
|
[
"MIT"
] | 2 |
2019-09-13T14:38:51.000Z
|
2021-05-30T17:32:20.000Z
|
/*
* author : Shuichi TAKANO
* since : Sat May 29 2021 16:06:36
*/
#ifndef _1FC51C99_5134_634A_F51B_A20C2EA86E06
#define _1FC51C99_5134_634A_F51B_A20C2EA86E06
#include <stdint.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct _SWSPIConfig
{
int pinSS;
int gpioSS;
int pinSCLK;
int gpioSCLK;
int pinMISO;
int gpioMISO;
uint8_t pullupMISO;
int pinMOSI;
int gpioMOSI;
} SWSPIConfig;
void initSWSPI(const SWSPIConfig *cfg);
void enableSWSPI(const SWSPIConfig *cfg);
void disableSWSPI(const SWSPIConfig *cfg);
int sendByteReversedSWSPI(const SWSPIConfig *cfg, int data);
#ifdef __cplusplus
}
#endif
#endif /* _1FC51C99_5134_634A_F51B_A20C2EA86E06 */
| 17.837209 | 64 | 0.674055 |
f6b3a66efa96de8cfdf38ac09ea7faff6caf0fa5
| 1,490 |
swift
|
Swift
|
RijksmuseumTests/APIServiceTests.swift
|
iBachek/rijksmuseum
|
15382c72783b2975e34ec2fed453e2a019698844
|
[
"MIT"
] | null | null | null |
RijksmuseumTests/APIServiceTests.swift
|
iBachek/rijksmuseum
|
15382c72783b2975e34ec2fed453e2a019698844
|
[
"MIT"
] | null | null | null |
RijksmuseumTests/APIServiceTests.swift
|
iBachek/rijksmuseum
|
15382c72783b2975e34ec2fed453e2a019698844
|
[
"MIT"
] | null | null | null |
import XCTest
@testable import Services
class APIServiceTests: XCTestCase {
lazy var apiRequestor = APIRequestorMock()
lazy var apiService: APIServiceProtocol = APIService(requestor: apiRequestor)
override func setUpWithError() throws {
apiRequestor.path = nil
apiRequestor.method = nil
apiRequestor.parameters = nil
}
func testGetCollections() throws {
let dictionary = ["key": "value"]
let parameters = APIServiceParametrsMock(parameters: dictionary)
let operation = apiService.collectionsOperation(using: parameters)
operation.start()
XCTAssertEqual(apiRequestor.path, "/collection")
XCTAssertEqual(apiRequestor.method, HTTPMethod.GET)
XCTAssertEqual(apiRequestor.parameters, dictionary)
}
}
final class APIRequestorMock: APIRequestorProtocol {
var path: String?
var method: HTTPMethod?
var parameters: [String: String]?
public func dataTask(path: String,
method: HTTPMethod,
parameters: [String: String]?,
completion: @escaping (Result<Data, APIError>) -> Void) -> URLSessionDataTask? {
self.path = path
self.method = method
self.parameters = parameters
return nil
}
}
struct APIServiceParametrsMock: APIServiceParametrsProtocol {
let parameters: [String: String]
var jsonParametrs: [String: String] {
return parameters
}
}
| 28.653846 | 105 | 0.65906 |
5b90715eaa847879c30ba8c7dc8bc15eae4996e4
| 2,468 |
sql
|
SQL
|
teste_dev_tbEnquetes.sql
|
carlosbaraldi/testedevWEB
|
121e88170288b5598bcc295756865dcdf98b7de5
|
[
"MIT"
] | null | null | null |
teste_dev_tbEnquetes.sql
|
carlosbaraldi/testedevWEB
|
121e88170288b5598bcc295756865dcdf98b7de5
|
[
"MIT"
] | null | null | null |
teste_dev_tbEnquetes.sql
|
carlosbaraldi/testedevWEB
|
121e88170288b5598bcc295756865dcdf98b7de5
|
[
"MIT"
] | null | null | null |
-- MySQL dump 10.13 Distrib 8.0.25, for Win64 (x86_64)
--
-- Host: teste_dev.mysql.dbaas.com.br Database: teste_dev
-- ------------------------------------------------------
-- Server version 5.7.32-35-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `tbEnquetes`
--
DROP TABLE IF EXISTS `tbEnquetes`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `tbEnquetes` (
`idEnquete` int(11) NOT NULL AUTO_INCREMENT,
`idUsuario` int(11) NOT NULL,
`tituloEnquete` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`perguntaEnquete` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`created_at` timestamp(6) NULL DEFAULT NULL,
`updated_at` timestamp(6) NULL DEFAULT NULL,
`deleted_at` timestamp(6) NULL DEFAULT NULL,
PRIMARY KEY (`idEnquete`)
) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tbEnquetes`
--
LOCK TABLES `tbEnquetes` WRITE;
/*!40000 ALTER TABLE `tbEnquetes` DISABLE KEYS */;
INSERT INTO `tbEnquetes` VALUES (50,1,'Vc mora','Vc mora em Pinhal?','2021-10-03 15:46:59.000000','2021-10-03 15:46:59.000000',NULL),(51,1,'Quantos Anos','Quantos Anos você tem?','2021-10-03 20:09:43.000000','2021-10-03 20:09:43.000000',NULL);
/*!40000 ALTER TABLE `tbEnquetes` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2021-10-03 19:45:12
| 43.298246 | 243 | 0.721637 |
907626e8a4e9fd647ec819c31819f096a2338e13
| 1,231 |
swift
|
Swift
|
Tests/MapboxNavigationTests/NavigationLocationProviderTests.swift
|
VishnuNCS/mapbox-navigation-ios
|
9e42a853023d9ff1c0ed5535fd693a1b8ceb8411
|
[
"MIT"
] | 1 |
2022-02-19T13:25:37.000Z
|
2022-02-19T13:25:37.000Z
|
Tests/MapboxNavigationTests/NavigationLocationProviderTests.swift
|
VishnuNCS/mapbox-navigation-ios
|
9e42a853023d9ff1c0ed5535fd693a1b8ceb8411
|
[
"MIT"
] | null | null | null |
Tests/MapboxNavigationTests/NavigationLocationProviderTests.swift
|
VishnuNCS/mapbox-navigation-ios
|
9e42a853023d9ff1c0ed5535fd693a1b8ceb8411
|
[
"MIT"
] | null | null | null |
import XCTest
import MapboxMaps
@testable import MapboxNavigation
import TestHelper
class NavigationLocationProviderTests: TestCase {
var navigationMapView: NavigationMapView!
override func setUp() {
super.setUp()
navigationMapView = NavigationMapView(frame: .zero)
}
override func tearDown() {
navigationMapView = nil
super.tearDown()
}
func testOverriddenLocationProviderUpdateLocations() {
let navigationLocationManagerStub = NavigationLocationManagerStub()
let navigationLocationProviderStub = NavigationLocationProvider(locationManager: navigationLocationManagerStub)
let location = CLLocation(latitude: 0, longitude: 0)
navigationMapView.mapView.location.overrideLocationProvider(with: navigationLocationProviderStub)
navigationLocationProviderStub.didUpdateLocations(locations: [location])
XCTAssert(navigationMapView.mapView?.location.locationProvider is NavigationLocationProvider, "Failed to override mapView location provider.")
XCTAssertEqual(navigationMapView.mapView.location.latestLocation?.coordinate, location.coordinate, "Failed to update mapView location.")
}
}
| 39.709677 | 150 | 0.753046 |
c6b7a184a775de182e9a1bec6bd7a26f41f75f1a
| 393 |
rb
|
Ruby
|
db/migrate/20120116135432_add_translator_visible_to_questionnaires.rb
|
unepwcmc/ORS
|
6934c8e6b26a6d0cb585f5e8f342e7db73e9d914
|
[
"BSD-3-Clause"
] | 3 |
2016-12-08T09:21:55.000Z
|
2019-06-29T16:03:47.000Z
|
db/migrate/20120116135432_add_translator_visible_to_questionnaires.rb
|
unepwcmc/ORS
|
6934c8e6b26a6d0cb585f5e8f342e7db73e9d914
|
[
"BSD-3-Clause"
] | 26 |
2016-09-22T08:24:45.000Z
|
2022-02-26T01:23:32.000Z
|
db/migrate/20120116135432_add_translator_visible_to_questionnaires.rb
|
unepwcmc/ORS
|
6934c8e6b26a6d0cb585f5e8f342e7db73e9d914
|
[
"BSD-3-Clause"
] | null | null | null |
class AddTranslatorVisibleToQuestionnaires < ActiveRecord::Migration
def self.up
unless column_exists?(:questionnaires, :translator_visible)
add_column :questionnaires, :translator_visible, :boolean, default: false
end
end
def self.down
if column_exists?(:questionnaires, :translator_visible)
remove_column :questionnaires, :translator_visible
end
end
end
| 28.071429 | 79 | 0.765903 |
56015e9fa8333eb6ce82b37e0e0bdc5c2764504a
| 2,795 |
kt
|
Kotlin
|
CustomViewTest/app/src/main/java/com/example/lt/customviewtest/view/CameraView.kt
|
maxdylan/rwx_test
|
db3ee7b07c8d1fd35d24d53c6d79bb8fa13eb7c8
|
[
"Apache-2.0"
] | null | null | null |
CustomViewTest/app/src/main/java/com/example/lt/customviewtest/view/CameraView.kt
|
maxdylan/rwx_test
|
db3ee7b07c8d1fd35d24d53c6d79bb8fa13eb7c8
|
[
"Apache-2.0"
] | null | null | null |
CustomViewTest/app/src/main/java/com/example/lt/customviewtest/view/CameraView.kt
|
maxdylan/rwx_test
|
db3ee7b07c8d1fd35d24d53c6d79bb8fa13eb7c8
|
[
"Apache-2.0"
] | null | null | null |
package com.example.lt.customviewtest.view
import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.view.View
import androidx.core.graphics.withSave
import com.example.lt.customviewtest.R
import com.example.lt.customviewtest.extension.px
import kotlin.math.max
class CameraView(context: Context, attrs: AttributeSet?) : View(context, attrs) {
private val bitmap = getAvatar(300f.px.toInt())
private val paint = Paint(Paint.ANTI_ALIAS_FLAG)
private val camera = Camera().apply {
setLocation(0f,0f,-6f*resources.displayMetrics.density)
}
var leftCameraAngle = 0f
set(value) {
field = value
invalidate()
}
var rightCameraAngle = 0f
set(value) {
field = value
invalidate()
}
var flipAngle = 0f
set(value) {
field = value
invalidate()
}
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
canvas.save()
canvas.translate(width/2f,height/2f)
canvas.rotate(-flipAngle)
camera.save()
camera.rotateX(leftCameraAngle)
camera.applyToCanvas(canvas)
camera.restore()
canvas.clipRect(
- bitmap.width.toFloat(),
- bitmap.height.toFloat() ,
bitmap.width.toFloat(),
0f
)
canvas.rotate(flipAngle)
canvas.translate(-width/2f,-height/2f)
canvas.drawBitmap(
bitmap,
width / 2f - bitmap.width / 2f,
height / 2f - bitmap.height / 2f,
paint
)
canvas.restore()
canvas.save()
canvas.translate(width / 2f, height / 2f)
canvas.rotate(-flipAngle)
camera.save()
camera.rotateX(rightCameraAngle)
camera.applyToCanvas(canvas)
camera.restore()
canvas.clipRect(
- bitmap.width.toFloat(),
0f,
bitmap.width.toFloat(),
bitmap.height.toFloat()
)
canvas.rotate(flipAngle)
canvas.translate(-width/2f,- height / 2f)
canvas.drawBitmap(
bitmap,
width / 2f - bitmap.width / 2f,
height / 2f - bitmap.height / 2f,
paint
)
canvas.restore()
}
private fun getAvatar(width:Int):Bitmap{
val options = BitmapFactory.Options()
options.inJustDecodeBounds = true
BitmapFactory.decodeResource(resources, R.drawable.squire, options)
options.inJustDecodeBounds = false
options.inDensity = max(options.outWidth,options.outHeight)
options.inTargetDensity = width
return BitmapFactory.decodeResource(resources,R.drawable.squire,options)
}
}
| 29.734043 | 81 | 0.595707 |
c0b0cc42f770f8d160ad5d99ebe688a05d25ca3a
| 128 |
sql
|
SQL
|
oracle/oracle 11g/SYS/Views/USER_TAB_COMMENTS.sql
|
LeeBaekHaeng/sql
|
12c83fb31cfdcb52058a3e577844e0a0a8a6616e
|
[
"Apache-2.0"
] | null | null | null |
oracle/oracle 11g/SYS/Views/USER_TAB_COMMENTS.sql
|
LeeBaekHaeng/sql
|
12c83fb31cfdcb52058a3e577844e0a0a8a6616e
|
[
"Apache-2.0"
] | null | null | null |
oracle/oracle 11g/SYS/Views/USER_TAB_COMMENTS.sql
|
LeeBaekHaeng/sql
|
12c83fb31cfdcb52058a3e577844e0a0a8a6616e
|
[
"Apache-2.0"
] | null | null | null |
SELECT /* */
A.*
FROM USER_TAB_COMMENTS A
WHERE 1 = 1
-- AND A.OWNER = 'SYS'
-- AND A.VIEW_NAME LIKE 'DBA_TA%'
;
| 16 | 35 | 0.554688 |
6b445ddcb3f4d12b98c5dc17f6c4636b1fca06d4
| 4,382 |
h
|
C
|
src/httpjsonapi.h
|
YoungMiao/deepdetcet_gpu
|
0ef97f9521b0000d69f0160a94bb0da099f0d29c
|
[
"Apache-2.0"
] | null | null | null |
src/httpjsonapi.h
|
YoungMiao/deepdetcet_gpu
|
0ef97f9521b0000d69f0160a94bb0da099f0d29c
|
[
"Apache-2.0"
] | null | null | null |
src/httpjsonapi.h
|
YoungMiao/deepdetcet_gpu
|
0ef97f9521b0000d69f0160a94bb0da099f0d29c
|
[
"Apache-2.0"
] | null | null | null |
/**
* DeepDetect
* Copyright (c) 2015 Emmanuel Benazera
* Author: Emmanuel Benazera <beniz@droidnik.fr>
*
* This file is part of deepdetect.
*
* deepdetect is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* deepdetect is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with deepdetect. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HTTPJSONAPI_H
#define HTTPJSONAPI_H
#include "jsonapi.h"
#include <math.h>
#include <boost/network/protocol/http/server.hpp>
#include <boost/network/uri.hpp>
#include <boost/network/uri/uri_io.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/ml/ml.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
//#include <fstream>
#include <unistd.h>
#include <algorithm>
//#define _GLIBCXX_USE_CXX11_ABI 0
namespace http = boost::network::http;
namespace uri = boost::network::uri;
class APIHandler;
typedef http::server<APIHandler> http_server;
namespace dd
{
std::string uri_query_to_json(const std::string &req_query);
class HttpJsonAPI : public JsonAPI
{
public:
HttpJsonAPI();
~HttpJsonAPI();
void stop_server();
int start_server_daemon(const std::string &host,
const std::string &port,
const int &nthreads);
int start_server(const std::string &host,
const std::string &port,
const int &nthreads);
int boot(int argc, char *argv[]);
static void terminate(int param);
http_server *_dd_server = nullptr; /**< main reusable pointer to server object */
std::future<int> _ft; /**< holds the results from the main server thread */
};
class CSVM
{
public:
CSVM() {}
~CSVM() {}
int m_nFeatNum; //图片中目标个数
int m_nObjNum; //图片中最大检测到的目标个数
CvSVM m_cSVM;
int load_model(std::string &sPathModel){
m_nFeatNum = 10; //图片中目标个数
m_nObjNum = 10; //图片中最大检测到的目标个数
std::string sTemp = sPathModel + "_param";
if(access(sPathModel.c_str(),0)==-1 || access(sTemp.c_str(),0)==-1)
{
//cout<<"The file does not exist!:"<<sPathModel<<" or "<<sTemp<<endl;
return -1;
}
m_cSVM.load(sPathModel.c_str());
std::fstream file;
file.open(sTemp.c_str(),std::ios::in);
char buffer[256];
std::string str;
while(!file.eof())
{
file.getline(buffer,256,'\n');//getline(char *,int,char) 表示该行字符达到256个或遇到换行就结束
sTemp = buffer;
std::vector<std::string> vs;
splitString(sTemp, "=", vs);
if (2==vs.size())
{
if (vs[0] == "feat_num")
m_nFeatNum = atoi(vs[1].c_str());
if (vs[0] == "obj_num")
m_nObjNum = atoi(vs[1].c_str());
}
}
return 0;
};
double predict(std::vector<double> vdConf[], int nNum){
//转换数据
int nWidth = m_nObjNum*m_nFeatNum;
cv::Mat sample = cv::Mat::zeros(1, nWidth, CV_32FC1);
int nCol = 0;
int n = 0;
nNum = cv::min(nNum, m_nFeatNum);
for (int i=0; i<nNum; i++)
{
n = vdConf[i].size();
n = cv::min(n, m_nObjNum);
for (int j=0; j<n; j++)
{
nCol = i*m_nObjNum + j;
sample.at<float>(0,nCol) = vdConf[i][j];
//cout<<vdConf[i][j]<<endl;
}
}
//预测
int nPredictLabel = 0;
double dSum = m_cSVM.predict(sample,true);
double dCof = 1.0- cv::max(cv::min((float)(1 / (1 + exp((-1.0)*dSum))),float(1.0)),float(0.0));
return dCof;
};
void splitString(std::string str, std::string sStandard, std::vector<std::string> &_vsStr){
_vsStr.clear();
std::vector<std::string> vs = split(str, sStandard);
//cout<<"yuan = "<<str<<endl;
for (int i=0; i<vs.size(); i++)
{
_vsStr.push_back(vs[i]);
//cout<<vs[i]<<endl;
}
};
std::vector<std::string> split(std::string str, std::string pattern){
std::string::size_type pos;
std::vector<std::string> result;
str+=pattern;//扩展字符串以方便操作
int size=str.size();
for(int i=0; i<size; i++)
{
pos=str.find(pattern,i);
if(pos<size)
{
std::string s=str.substr(i,pos-i);
result.push_back(s);
i=pos+pattern.size()-1;
}
}
return result;
};
};
}
#endif
| 25.776471 | 96 | 0.65267 |
3b4c2cc8fb1b2b86ba360c399ce8bb18b18c9919
| 636 |
h
|
C
|
include/dioptre/window/null/window.h
|
tobscher/rts
|
7f30faf6a13d309e4db828be8be3c05d28c05364
|
[
"MIT"
] | 2 |
2015-05-14T16:07:30.000Z
|
2015-07-27T21:08:48.000Z
|
include/dioptre/window/null/window.h
|
tobscher/rts
|
7f30faf6a13d309e4db828be8be3c05d28c05364
|
[
"MIT"
] | null | null | null |
include/dioptre/window/null/window.h
|
tobscher/rts
|
7f30faf6a13d309e4db828be8be3c05d28c05364
|
[
"MIT"
] | null | null | null |
#ifndef DIOPTRE_WINDOW_NULL_WINDOW_H_
#define DIOPTRE_WINDOW_NULL_WINDOW_H_
#include "dioptre/window/window_interface.h"
namespace dioptre {
namespace window {
namespace null {
class Window : public dioptre::window::WindowInterface {
public:
Window() :
shouldClose_(false) { }
int initialize() { return 0; }
void destroy() { }
int shouldClose() { return shouldClose_; }
void setShouldClose(bool state) { shouldClose_ = state; }
void swapBuffers() { }
Size getSize() { return Size(800, 600); }
private:
bool shouldClose_;
}; // Window
} // null
} // window
} // dioptre
#endif // DIOPTRE_WINDOW_NULL_WINDOW_H_
| 21.2 | 59 | 0.713836 |
6ef034483fd4b58743702a7c2ae19820c0733094
| 15,938 |
html
|
HTML
|
COMP4537/API/V1/COMP4537-API-Documentation.html
|
dustinbrooks60/dustinbrooks
|
e02b5cd7645ba73f98b878141d6b08b07f869a64
|
[
"MIT"
] | null | null | null |
COMP4537/API/V1/COMP4537-API-Documentation.html
|
dustinbrooks60/dustinbrooks
|
e02b5cd7645ba73f98b878141d6b08b07f869a64
|
[
"MIT"
] | null | null | null |
COMP4537/API/V1/COMP4537-API-Documentation.html
|
dustinbrooks60/dustinbrooks
|
e02b5cd7645ba73f98b878141d6b08b07f869a64
|
[
"MIT"
] | null | null | null |
<!doctype html>
<html>
<head>
<title>Upgraded Quiz API for COMP4537 Term Project</title>
<style type="text/css">
body {
font-family: Trebuchet MS, sans-serif;
font-size: 15px;
color: #444;
margin-right: 24px;
}
h1 {
font-size: 25px;
}
h2 {
font-size: 20px;
}
h3 {
font-size: 16px;
font-weight: bold;
}
hr {
height: 1px;
border: 0;
color: #ddd;
background-color: #ddd;
}
.app-desc {
clear: both;
margin-left: 20px;
}
.param-name {
width: 100%;
}
.license-info {
margin-left: 20px;
}
.license-url {
margin-left: 20px;
}
.model {
margin: 0 0 0px 20px;
}
.method {
margin-left: 20px;
}
.method-notes {
margin: 10px 0 20px 0;
font-size: 90%;
color: #555;
}
pre {
padding: 10px;
margin-bottom: 2px;
}
.http-method {
text-transform: uppercase;
}
pre.get {
background-color: #0f6ab4;
}
pre.post {
background-color: #10a54a;
}
pre.put {
background-color: #c5862b;
}
pre.delete {
background-color: #a41e22;
}
.huge {
color: #fff;
}
pre.example {
background-color: #f3f3f3;
padding: 10px;
border: 1px solid #ddd;
}
code {
white-space: pre;
}
.nickname {
font-weight: bold;
}
.method-path {
font-size: 1.5em;
background-color: #0f6ab4;
}
.up {
float:right;
}
.parameter {
width: 500px;
}
.param {
width: 500px;
padding: 10px 0 0 20px;
font-weight: bold;
}
.param-desc {
width: 700px;
padding: 0 0 0 20px;
color: #777;
}
.param-type {
font-style: italic;
}
.param-enum-header {
width: 700px;
padding: 0 0 0 60px;
color: #777;
font-weight: bold;
}
.param-enum {
width: 700px;
padding: 0 0 0 80px;
color: #777;
font-style: italic;
}
.field-label {
padding: 0;
margin: 0;
clear: both;
}
.field-items {
padding: 0 0 15px 0;
margin-bottom: 15px;
}
.return-type {
clear: both;
padding-bottom: 10px;
}
.param-header {
font-weight: bold;
}
.method-tags {
text-align: right;
}
.method-tag {
background: none repeat scroll 0% 0% #24A600;
border-radius: 3px;
padding: 2px 10px;
margin: 2px;
color: #FFF;
display: inline-block;
text-decoration: none;
}
</style>
</head>
<body>
<h1>Upgraded Quiz API for COMP4537 Term Project</h1>
<div class="app-desc">Upgraded Quiz API</div>
<div class="app-desc">More information: <a href="https://helloreverb.com">https://helloreverb.com</a></div>
<div class="app-desc">Contact Info: <a href="hello@helloreverb.com">hello@helloreverb.com</a></div>
<div class="app-desc">Version: UpdatedQuizAPI</div>
<div class="app-desc">BasePath:/COMP4537-TermProject/documentation/UpdatedQuizAPI</div>
<div class="license-info">Apache 2.0</div>
<div class="license-url">http://www.apache.org/licenses/LICENSE-2.0.html</div>
<h2>Access</h2>
<h2><a name="__Methods">Methods</a></h2>
[ Jump to <a href="#__Models">Models</a> ]
<h3>Table of Contents </h3>
<div class="method-summary"></div>
<h4><a href="#Admins">Admins</a></h4>
<ul>
<li><a href="#createQuiz"><code><span class="http-method">post</span> /quizzes</code></a></li>
<li><a href="#deleteQuestion"><code><span class="http-method">delete</span> /questions</code></a></li>
<li><a href="#updateQuestion"><code><span class="http-method">put</span> /questions</code></a></li>
</ul>
<h4><a href="#StudentsAndAdmins">StudentsAndAdmins</a></h4>
<ul>
<li><a href="#getQuizzes and getAllQuizzes"><code><span class="http-method">get</span> /choices</code></a></li>
<li><a href="#getQuizzes and retrieveAllQuizzes"><code><span class="http-method">get</span> /quizzes</code></a></li>
<li><a href="#students/getQuizzes and admin/getAllQuizzes"><code><span class="http-method">get</span> /questions</code></a></li>
</ul>
<h1><a name="Admins">Admins</a></h1>
<div class="method"><a name="createQuiz"/>
<div class="method-path">
<a class="up" href="#__Methods">Up</a>
<pre class="post"><code class="huge"><span class="http-method">post</span> /quizzes</code></pre></div>
<div class="method-summary">adds a new quiz to the database (<span class="nickname">createQuiz</span>)</div>
<div class="method-notes">Add a new quiz to the database</div>
<h3 class="field-label">Consumes</h3>
This API call consumes the following media types via the <span class="header">Content-Type</span> request header:
<ul>
<li><code>string</code></li>
</ul>
<h3 class="field-label">Request body</h3>
<div class="field-items">
<div class="param">quizName <a href="#String">String</a> (optional)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> — name of the quiz to add </div>
</div> <!-- field-items -->
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">200</h4>
new quiz created
<a href="#"></a>
<h4 class="field-label">400</h4>
invalid input, quiz not created
<a href="#"></a>
</div> <!-- method -->
<hr/>
<div class="method"><a name="deleteQuestion"/>
<div class="method-path">
<a class="up" href="#__Methods">Up</a>
<pre class="delete"><code class="huge"><span class="http-method">delete</span> /questions</code></pre></div>
<div class="method-summary">deletes a question (<span class="nickname">deleteQuestion</span>)</div>
<div class="method-notes">Deletes a question from the DB</div>
<h3 class="field-label">Request body</h3>
<div class="field-items">
<div class="param">question <a href="#question">question</a> (optional)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> — question object reference to delete the old question </div>
</div> <!-- field-items -->
<h3 class="field-label">Return type</h3>
<div class="return-type">
String
</div>
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>""</code></pre>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">200</h4>
quiz question deleted from DB
<a href="#String">String</a>
<h4 class="field-label">400</h4>
bad SQL query
<a href="#"></a>
</div> <!-- method -->
<hr/>
<div class="method"><a name="updateQuestion"/>
<div class="method-path">
<a class="up" href="#__Methods">Up</a>
<pre class="put"><code class="huge"><span class="http-method">put</span> /questions</code></pre></div>
<div class="method-summary">updates a question (<span class="nickname">updateQuestion</span>)</div>
<div class="method-notes">Updates a question in the DB</div>
<h3 class="field-label">Request body</h3>
<div class="field-items">
<div class="param">question <a href="#question">question</a> (optional)</div>
<div class="param-desc"><span class="param-type">Body Parameter</span> — question object to update the old question with </div>
</div> <!-- field-items -->
<h3 class="field-label">Return type</h3>
<div class="return-type">
String
</div>
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>""</code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">200</h4>
quiz question updated correctly
<a href="#String">String</a>
<h4 class="field-label">400</h4>
bad SQL query
<a href="#"></a>
</div> <!-- method -->
<hr/>
<h1><a name="StudentsAndAdmins">StudentsAndAdmins</a></h1>
<div class="method"><a name="getQuizzes and getAllQuizzes"/>
<div class="method-path">
<a class="up" href="#__Methods">Up</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /choices</code></pre></div>
<div class="method-summary">retrieves all quizzes (<span class="nickname">getQuizzes and getAllQuizzes</span>)</div>
<div class="method-notes">Retrieves all choices for a quiz based on the quiz ID given</div>
<h3 class="field-label">Return type</h3>
<div class="return-type">
Object
</div>
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: </div>
<pre class="example"><code></code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>string</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">200</h4>
all choices for a specific quiz
<a href="#Object">Object</a>
<h4 class="field-label">400</h4>
bad SQL query
<a href="#"></a>
</div> <!-- method -->
<hr/>
<div class="method"><a name="getQuizzes and retrieveAllQuizzes"/>
<div class="method-path">
<a class="up" href="#__Methods">Up</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /quizzes</code></pre></div>
<div class="method-summary">retrieves all quizzes (<span class="nickname">getQuizzes and retrieveAllQuizzes</span>)</div>
<div class="method-notes">Retrieves all the quizzes in the database.</div>
<h3 class="field-label">Return type</h3>
<div class="return-type">
array[<a href="#quiz">quiz</a>]
</div>
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>[ {
"quizId" : 1,
"name" : "JavaScript Quiz"
}, {
"quizId" : 1,
"name" : "JavaScript Quiz"
} ]</code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">200</h4>
all quizzes in the DB -- regardless of ID
<h4 class="field-label">400</h4>
bad SQL query
<a href="#"></a>
</div> <!-- method -->
<hr/>
<div class="method"><a name="students/getQuizzes and admin/getAllQuizzes"/>
<div class="method-path">
<a class="up" href="#__Methods">Up</a>
<pre class="get"><code class="huge"><span class="http-method">get</span> /questions</code></pre></div>
<div class="method-summary">retrieves all quizzes (<span class="nickname">students/getQuizzes and admin/getAllQuizzes</span>)</div>
<div class="method-notes">Retrieves all of the questions and choices depending on the ID</div>
<h3 class="field-label">Return type</h3>
<div class="return-type">
array[<a href="#question">question</a>]
</div>
<!--Todo: process Response Object and its headers, schema, examples -->
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>[ {
"questionId" : 1,
"answer" : "A",
"choices" : "{}",
"questionBody" : "This is a question?"
}, {
"questionId" : 1,
"answer" : "A",
"choices" : "{}",
"questionBody" : "This is a question?"
} ]</code></pre>
<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="header">Content-Type</span> response header.
<ul>
<li><code>application/json</code></li>
</ul>
<h3 class="field-label">Responses</h3>
<h4 class="field-label">200</h4>
quiz question
<h4 class="field-label">400</h4>
bad SQL query
<a href="#"></a>
</div> <!-- method -->
<hr/>
<h2><a name="__Models">Models</a></h2>
[ Jump to <a href="#__Methods">Methods</a> ]
<h3>Table of Contents</h3>
<ol>
<li><a href="#choice"><code>choice</code> - </a></li>
<li><a href="#question"><code>question</code> - </a></li>
<li><a href="#quiz"><code>quiz</code> - </a></li>
</ol>
<div class="model">
<h3><a name="choice"><code>choice</code> - </a> <a class="up" href="#__Models">Up</a></h3>
<div class='model-description'></div>
<div class="field-items">
<div class="param">choiceId </div><div class="param-desc"><span class="param-type"><a href="#integer">Integer</a></span> </div>
<div class="param-desc"><span class="param-type">example: 1</span></div>
<div class="param">choice </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> </div>
<div class="param-desc"><span class="param-type">example: A</span></div>
<div class="param">choiceBody </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> </div>
<div class="param-desc"><span class="param-type">example: <span> tag is the answer</span></div>
</div> <!-- field-items -->
</div>
<div class="model">
<h3><a name="question"><code>question</code> - </a> <a class="up" href="#__Models">Up</a></h3>
<div class='model-description'></div>
<div class="field-items">
<div class="param">questionId </div><div class="param-desc"><span class="param-type"><a href="#integer">Integer</a></span> </div>
<div class="param-desc"><span class="param-type">example: 1</span></div>
<div class="param">questionBody </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> </div>
<div class="param-desc"><span class="param-type">example: This is a question?</span></div>
<div class="param">choices </div><div class="param-desc"><span class="param-type"><a href="#object">Object</a></span> </div>
<div class="param">answer </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> </div>
<div class="param-desc"><span class="param-type">example: A</span></div>
</div> <!-- field-items -->
</div>
<div class="model">
<h3><a name="quiz"><code>quiz</code> - </a> <a class="up" href="#__Models">Up</a></h3>
<div class='model-description'></div>
<div class="field-items">
<div class="param">quizId </div><div class="param-desc"><span class="param-type"><a href="#integer">Integer</a></span> </div>
<div class="param-desc"><span class="param-type">example: 1</span></div>
<div class="param">name </div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> </div>
<div class="param-desc"><span class="param-type">example: JavaScript Quiz</span></div>
</div> <!-- field-items -->
</div>
</body>
</html>
| 29.846442 | 142 | 0.627243 |
b2e84727d200add756532d87eca711fb92b61dde
| 1,570 |
py
|
Python
|
setup.py
|
Peque/mmsim
|
b3a78ad0119db6ee8df349a89559ea8006c85db1
|
[
"BSD-3-Clause"
] | null | null | null |
setup.py
|
Peque/mmsim
|
b3a78ad0119db6ee8df349a89559ea8006c85db1
|
[
"BSD-3-Clause"
] | null | null | null |
setup.py
|
Peque/mmsim
|
b3a78ad0119db6ee8df349a89559ea8006c85db1
|
[
"BSD-3-Clause"
] | null | null | null |
"""
Setup module.
"""
from setuptools import setup
from mmsim import __version__
setup(
name='mmsim',
version=__version__,
description='A simple Micromouse Maze Simulator server',
long_description="""The server can load different mazes and any client
can connect to it to ask for the current position walls, move from
one cell to another and visualize the simulated micromouse state.""",
url='https://github.com/Theseus/mmsim',
author='Miguel Sánchez de León Peque',
author_email='peque@neosit.es',
license='BSD License',
classifiers=[
'Development Status :: 3 - Alpha',
'Topic :: Utilities',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
],
keywords='micromouse maze server simulator',
entry_points={
'console_scripts': [
'mmsim = mmsim.commands:launch',
],
},
packages=['mmsim'],
install_requires=[
'click',
'numpy',
'pyqtgraph',
'pyqt5',
'pyzmq'],
extras_require={
'docs': [
'doc8',
'sphinx',
'sphinx_rtd_theme',
],
'lint': [
'flake8',
'flake8-bugbear',
'flake8-per-file-ignores',
'flake8-quotes',
'pep8-naming',
],
'test': [
'pytest',
'pytest-cov',
],
},
)
| 26.610169 | 77 | 0.54586 |
203ed35411b708a42bd91c09eb2d47f5ad8a7d3a
| 8,949 |
css
|
CSS
|
myweb/mydreamer/ui/focus/skitter_slide_show/css/styles.css
|
zodiac-xl/node-Iacg
|
4d2bd282b212b205bc137ec3d06a785f7d74cc91
|
[
"MIT"
] | 1 |
2017-05-18T05:57:21.000Z
|
2017-05-18T05:57:21.000Z
|
myweb/mydreamer/ui/focus/skitter_slide_show/css/styles.css
|
zodiac-xl/node-Iacg
|
4d2bd282b212b205bc137ec3d06a785f7d74cc91
|
[
"MIT"
] | null | null | null |
myweb/mydreamer/ui/focus/skitter_slide_show/css/styles.css
|
zodiac-xl/node-Iacg
|
4d2bd282b212b205bc137ec3d06a785f7d74cc91
|
[
"MIT"
] | 1 |
2017-03-22T10:06:19.000Z
|
2017-03-22T10:06:19.000Z
|
* { margin:0; padding:0; list-style:none; }
body { background:url(../images/bg-page.png) repeat left top; font-family:'Mako',arial,tahoma; }
a, a img { border:none; outline:none; color:#004499; }
.content-width { width:980px; margin:0 auto; }
.clear { clear:both; }
#page { background:url(../images/bg-header-repeat.png) repeat-x left top; margin-bottom:50px; }
#header { height:110px; background:url(../images/bg-header.png) no-repeat center top; margin:0 auto; margin-bottom:20px; }
#header h1 a { width:220px; height:90px; float:left; margin:0px 0 0 0; overflow:hidden; text-indent:-9999em; background:url(../images/logo.png) no-repeat center top; }
#header nav { float:right; margin:30px 0 0 0; }
#header nav a { color:#fff; padding:10px 25px; -moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px; float:left; margin:0 15px 0 0; text-decoration:none; text-shadow:#000 1px 1px 0;
-moz-transition:all ease-out 0.3s;
-webkit-transition:all ease-out 0.3s;
transition:all ease-out 0.3s;
position:relative;
z-index:5;
}
#header nav a:hover, #header nav a.active { background:#000; /*box-shadow:rgba(255,255,255,0.3) 0 0 10px;*/ }
#bt-lang { width:40px; height:40px; position:absolute; overflow:hidden; text-indent:-9999em; background:url(../images/bt-lang.png) no-repeat center top; right:0; top:0; -moz-transition:opacity 0.2s; }
#bt-lang:hover { opacity:0.7; }
#box-languages { position:absolute; top:40px; right:0; background:#000; width:40px; z-index:250; -moz-border-radius:0 0 0 3px;-webkit-border-radius:0 0 0 3px;border-radius:0 0 0 3px; display:none; }
#box-languages ul { float:left; margin-top:3px; width:40px; padding:0; }
#box-languages ul li { float:left; margin-bottom:0px; width:40px; text-align:center; padding:0; }
#box-languages ul li a { float:left; margin-left:4px; }
#box-languages ul li a img { float:left; }
#content {}
/* =Pages
-------------------------------------------------------------- */
.page { display:none; }
.page.active { display:block; }
.page h1 { font-size:36px; margin-bottom:20px; letter-spacing:-2px; }
.page h2 { margin-bottom:20px; color:#777; }
.page h3 { margin-bottom:20px; color:#999; }
/* =Configurations
-------------------------------------------------------------- */
#box-bts-config { position:relative; }
.bt-config { background:url(../images/bt-config.png) no-repeat center top; width:120px; height:120px; text-align:center; position:relative; z-index:5; text-indent:-9999em; overflow:hidden; display:block; margin:0 auto; }
#box-config { background:url(../images/bg-config.jpg) repeat left top; margin-top:-60px; padding-bottom:10px; color:#fff; float:left; width:100%; display:none; }
#nav-config { float:left; margin:60px 0 20px 190px; }
#nav-config a { float:left; padding:10px 20px; border-bottom:5px solid #333; color:#fff; text-decoration:none; text-shadow:none;
-moz-transition:all 0.2s;
}
#nav-config a:hover { text-shadow:#000 0 0 5px; border-color:#555; }
#nav-config a.active { border-color:#228822; }
.back-nav { background:#000; position:absolute; z-index:4; }
#box-all-config { float:left; width:100%; position:relative; margin-bottom:10px; }
#box-all-config .item-config { display:none; position:absolute; top:0; left:0; }
#box-all-config .item-config.active { display:block !important; }
#box-animations {}
#bt-apply { position:absolute; top:32px; right:0px; text-indent:-9999em; overflow:hidden; width:64px; height:64px; background:url(../images/bt-apply.png) no-repeat left top; display:none; }
#bt-apply:hover { background:url(../images/bt-apply-over.png) no-repeat left top; }
#box-your-code {}
#box-your-code pre { background:#111; padding:30px; -moz-border-radius:3px;-webkit-border-radius:33px;border-radius:3px; font:14px consolas,'courier new'; padding-left:80px; }
#bt-up { position:fixed; top: 50%; right:50px; width:100px; height:100px; opacity:0.2; background:url(../images/bt-up.png) no-repeat left top; text-indent:-9999em; overflow:hidden; cursor:pointer; }
/* =Buttons
-------------------------------------------------------------- */
.list-buttons {}
.list-buttons li { position:relative; float:left; }
.list-buttons li a { float:left; padding:10px 20px; background:#111; color:#fff; text-decoration:none; font-size:14px; -moz-border-radius:3
px;-webkit-border-radius:3px;border-radius:3px; margin:0 10px 10px 0; }
.list-buttons li a:hover { background:#000; }
.list-buttons li a.new { background:#991100; }
.list-buttons li a.new:hover { background:#aa1100; }
.list-buttons li a.active { background:#228822; }
.list-buttons li a.active:hover { background:#009922; }
.list-select { display:none; position:absolute; top:0; left:0; -moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px; padding:3px 0; background:#111; z-index:10; border:1px solid #000; box-shadow:#333 0 0 5px; width:120px; }
.list-select li { width:120px; }
.list-select li a { padding:5px 10px; width:100px; margin:0; -moz-border-radius:0px;-webkit-border-radius:0px;border-radius:0px; }
/* =Footer
-------------------------------------------------------------- */
#footer { position:fixed; bottom:0; left:0; width:100%;height:50px; z-index:200; }
#credits { float:left; margin:2px 0 0 5px; text-indent:-9999em; overflow:hidden; width:42px; height:42px; background:url(../images/logo-thiago.png) no-repeat left top; position:relative; z-index:10; }
#footer section { float:right; margin:15px 15px 0 0; position:relative; z-index:10; }
#back-footer { position:absolute; z-index:9; background:url(../images/bg-page.png) repeat left top;opacity:0.8; width:100%; height:50px; }
/* =Skitter
-------------------------------------------------------------- */
.border-skitter { margin:0px auto; border:1px solid #000; width:800px; height:300px; background:#333; margin-bottom:40px; -moz-box-shadow:rgba(0,0,0,0.5) 0 0 10px; }
/* =Documentation
-------------------------------------------------------------- */
#page-documentation {}
#page-documentation dl { margin-bottom:30px; float:left; width:100%; }
#page-documentation dl dt { font-size:26px; color:#cc3333; font-weight:bold; }
#page-documentation dl dd p.definition-description { font-size:16px; margin-bottom:10px; }
#page-documentation dl dd p { font-size:14px; margin-bottom:2px; float:left; width:100%; }
#page-documentation dl dd p strong { float:left; width:60px; background:#333; color:#fff; padding:2px 5px; margin-right:10px; -moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px; font-weight:normal; font-size:12px; text-align:right; }
#page-documentation dl dd p span { margin-left:85px; display:block; }
#page-documentation dl dd p.dd-default { }
#page-documentation dl dd p.dd-accept { }
#page-documentation dl dd p.dd-code { font-family:consolas,'courier new'; font-size:12px; }
/* =Updatelog
-------------------------------------------------------------- */
#box-updatelog { }
#box-updatelog dl { float:left; width:100%; margin-top:-30px; }
#box-updatelog dl dt { font-size:26px; color:#cc3333; font-weight:bold; margin-top:30px; }
#box-updatelog dl dd { font-size:14px; margin-bottom:2px; }
/* =Download
-------------------------------------------------------------- */
#box-download { margin:0 auto; width:580px; margin-top:50px; }
#box-download a { -moz-transition:color 0.2s; }
#box-download a:hover { color:#999; text-decoration:underline; }
.bt-download-big { width:200px; text-align:center; float:left; margin:0 50px; }
.bt-download-big a { font-size:18px; font-weight:bold; color:#000; text-decoration:none; position:relative; }
.bt-download-small { width:140px; text-align:center; float:left; margin-top:30px; }
.bt-download-small a { font-size:14px; color:#000; text-decoration:none; position:relative; }
#bt-download-wp { width:140px; height:140px; background:url(../images/bt-download-wp.png) no-repeat left top; text-indent:-9999em; overflow:hidden; cursor:pointer; float:left; }
#bt-download-helper { width:140px; height:140px; background:url(../images/bt-download-helper.png) no-repeat left top; text-indent:-9999em; overflow:hidden; cursor:pointer; float:left; }
#bt-download-stable { width:200px; height:200px; background:url(../images/bt-download-stable.png) no-repeat left top; text-indent:-9999em; overflow:hidden; cursor:pointer; float:left; }
#box-banner-help { float:left; width:100%; }
#banner-help { width:728px; margin:0 auto; /*margin-top:100px;*/ margin-top:50px; }
#banner-help p { font-size:14px; color:#000; margin-bottom:5px; }
#banner-help div { /*background:#000;*/ width:728px; height:90px; }
/* =Comments
-------------------------------------------------------------- */
#box-comments { }
/* =Multiple
-------------------------------------------------------------- */
#page-multiple {}
#page-multiple .border_box { margin-bottom:50px; }
/* =Donate
-------------------------------------------------------------- */
#box-donate { float: left; width: 100%; text-align: center; margin: 40px 0 0 0; }
| 55.583851 | 249 | 0.661862 |
fb9c3dfda736d7d0362e7af62401ecfd5fb56ba0
| 15,483 |
sql
|
SQL
|
competitions.sql
|
ChristopherDay/Competition
|
093957fd96297f1ad4fe2fb7e0f3fabcd0473d99
|
[
"MIT"
] | 1 |
2020-05-12T18:40:05.000Z
|
2020-05-12T18:40:05.000Z
|
competitions.sql
|
ChristopherDay/Competition
|
093957fd96297f1ad4fe2fb7e0f3fabcd0473d99
|
[
"MIT"
] | null | null | null |
competitions.sql
|
ChristopherDay/Competition
|
093957fd96297f1ad4fe2fb7e0f3fabcd0473d99
|
[
"MIT"
] | null | null | null |
-- MySQL dump 10.13 Distrib 8.0.18, for osx10.15 (x86_64)
--
-- Host: localhost Database: competitions
-- ------------------------------------------------------
-- Server version 8.0.18
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `cart`
--
DROP TABLE IF EXISTS `cart`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cart` (
`CA_id` int(11) NOT NULL,
`CA_comp` int(11) NOT NULL,
`CA_ans` int(11) NOT NULL,
`CA_date` int(11) NOT NULL,
`CA_qty` int(11) NOT NULL,
PRIMARY KEY (`CA_id`,`CA_comp`,`CA_ans`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `cart`
--
LOCK TABLES `cart` WRITE;
/*!40000 ALTER TABLE `cart` DISABLE KEYS */;
INSERT INTO `cart` VALUES (2,0,0,1586257702,0),(3,0,0,1586257774,0),(4,0,0,1586257822,0);
/*!40000 ALTER TABLE `cart` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `competitions`
--
DROP TABLE IF EXISTS `competitions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `competitions` (
`C_id` int(11) NOT NULL AUTO_INCREMENT,
`C_date` int(11) NOT NULL,
`C_title` varchar(120) NOT NULL,
`C_text` text NOT NULL,
`C_maxTickets` int(11) NOT NULL DEFAULT '0',
`C_maxPurchase` int(11) NOT NULL DEFAULT '0',
`C_cost` float(11,2) NOT NULL DEFAULT '0.00',
`C_question` varchar(255) NOT NULL,
`C_ans1` varchar(120) NOT NULL,
`C_ans2` varchar(120) NOT NULL,
`C_ans3` varchar(120) NOT NULL,
`C_correct` int(11) NOT NULL,
PRIMARY KEY (`C_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `competitions`
--
LOCK TABLES `competitions` WRITE;
/*!40000 ALTER TABLE `competitions` DISABLE KEYS */;
INSERT INTO `competitions` VALUES (1,1587385800,'Test Competition','<p>Just a test competition!</p><p>You can use the <b><u>HTML</u></b> editor to easily change the styles of text. </p>',250,25,2.50,'Who makes the iPhone?','Apple','Google','Microsoft',1),(2,1586176200,'Old Competition','<p>This was in the past and is now <b><u>locked!</u></b></p>',200,20,3.50,'Is this Locked?','Yes','No','Maybe',1);
/*!40000 ALTER TABLE `competitions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `FAQ`
--
DROP TABLE IF EXISTS `FAQ`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `FAQ` (
`FAQ_id` int(11) NOT NULL AUTO_INCREMENT,
`FAQ_title` varchar(120) NOT NULL,
`FAQ_text` text NOT NULL,
PRIMARY KEY (`FAQ_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `FAQ`
--
LOCK TABLES `FAQ` WRITE;
/*!40000 ALTER TABLE `FAQ` DISABLE KEYS */;
INSERT INTO `FAQ` VALUES (1,'Test FAQ item','Just some test text.'),(2,'Can you easily add questions?','Yes there is a very simple and easy to use Admin panel for it');
/*!40000 ALTER TABLE `FAQ` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `forumAccess`
--
DROP TABLE IF EXISTS `forumAccess`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `forumAccess` (
`FA_role` int(11) DEFAULT NULL,
`FA_forum` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `forumAccess`
--
LOCK TABLES `forumAccess` WRITE;
/*!40000 ALTER TABLE `forumAccess` DISABLE KEYS */;
/*!40000 ALTER TABLE `forumAccess` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `forums`
--
DROP TABLE IF EXISTS `forums`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `forums` (
`F_id` int(11) NOT NULL AUTO_INCREMENT,
`F_sort` int(11) NOT NULL DEFAULT '0',
`F_name` varchar(128) DEFAULT NULL,
PRIMARY KEY (`F_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `forums`
--
LOCK TABLES `forums` WRITE;
/*!40000 ALTER TABLE `forums` DISABLE KEYS */;
INSERT INTO `forums` VALUES (1,1,'Forum');
/*!40000 ALTER TABLE `forums` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `gameNews`
--
DROP TABLE IF EXISTS `gameNews`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `gameNews` (
`GN_id` int(11) NOT NULL AUTO_INCREMENT,
`GN_author` int(11) NOT NULL DEFAULT '0',
`GN_title` varchar(120) DEFAULT NULL,
`GN_text` text,
`GN_date` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`GN_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `gameNews`
--
LOCK TABLES `gameNews` WRITE;
/*!40000 ALTER TABLE `gameNews` DISABLE KEYS */;
/*!40000 ALTER TABLE `gameNews` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `notifications`
--
DROP TABLE IF EXISTS `notifications`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `notifications` (
`N_id` int(11) NOT NULL AUTO_INCREMENT,
`N_uid` int(11) NOT NULL DEFAULT '0',
`N_time` int(11) NOT NULL DEFAULT '0',
`N_text` text,
`N_read` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`N_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `notifications`
--
LOCK TABLES `notifications` WRITE;
/*!40000 ALTER TABLE `notifications` DISABLE KEYS */;
/*!40000 ALTER TABLE `notifications` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pages`
--
DROP TABLE IF EXISTS `pages`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `pages` (
`P_id` int(11) NOT NULL AUTO_INCREMENT,
`P_url` varchar(120) NOT NULL,
`P_title` varchar(120) NOT NULL,
`P_text` text NOT NULL,
PRIMARY KEY (`P_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pages`
--
LOCK TABLES `pages` WRITE;
/*!40000 ALTER TABLE `pages` DISABLE KEYS */;
INSERT INTO `pages` VALUES (1,'about','About Us','<p>Some text about your company goes here, there is a easy to use <b>HTML</b> editor you can use.</p>'),(2,'TOS','Terms Of Service','<p>Your T&C\'s go here, this is easily edited in the admin panel</p>'),(3,'privacy','Privacy Policy','<p>Your privacy policy goes here, this is easily edited in the admin panel!</p>'),(4,'home','Home Page','<p>Your home page will go here</p>');
/*!40000 ALTER TABLE `pages` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `posts`
--
DROP TABLE IF EXISTS `posts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `posts` (
`P_id` int(11) NOT NULL AUTO_INCREMENT,
`P_topic` int(11) DEFAULT NULL,
`P_date` int(11) DEFAULT NULL,
`P_user` int(11) DEFAULT NULL,
`P_body` text,
PRIMARY KEY (`P_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `posts`
--
LOCK TABLES `posts` WRITE;
/*!40000 ALTER TABLE `posts` DISABLE KEYS */;
INSERT INTO `posts` VALUES (1,1,1586175502,1,'A test forum post');
/*!40000 ALTER TABLE `posts` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `roleAccess`
--
DROP TABLE IF EXISTS `roleAccess`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `roleAccess` (
`RA_role` int(11) NOT NULL,
`RA_module` varchar(128) NOT NULL,
PRIMARY KEY (`RA_role`,`RA_module`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `roleAccess`
--
LOCK TABLES `roleAccess` WRITE;
/*!40000 ALTER TABLE `roleAccess` DISABLE KEYS */;
INSERT INTO `roleAccess` VALUES (2,'*');
/*!40000 ALTER TABLE `roleAccess` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `settings`
--
DROP TABLE IF EXISTS `settings`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `settings` (
`S_id` int(11) NOT NULL AUTO_INCREMENT,
`S_desc` varchar(255) DEFAULT NULL,
`S_value` text,
PRIMARY KEY (`S_id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `settings`
--
LOCK TABLES `settings` WRITE;
/*!40000 ALTER TABLE `settings` DISABLE KEYS */;
INSERT INTO `settings` VALUES (1,'validateUserEmail','1'),(2,'game_name','Company Name'),(3,'theme','default'),(4,'adminTheme','admin'),(5,'landingPage','home'),(6,'loginSuffix',''),(7,'loginPostfix',''),(8,'registerSuffix',''),(9,'registerPostfix',''),(10,'from_email','no-reply@yourcompany.com'),(11,'pointsName','');
/*!40000 ALTER TABLE `settings` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `topicReads`
--
DROP TABLE IF EXISTS `topicReads`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `topicReads` (
`TR_topic` int(11) DEFAULT NULL,
`TR_user` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `topicReads`
--
LOCK TABLES `topicReads` WRITE;
/*!40000 ALTER TABLE `topicReads` DISABLE KEYS */;
/*!40000 ALTER TABLE `topicReads` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `topics`
--
DROP TABLE IF EXISTS `topics`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `topics` (
`T_id` int(11) NOT NULL AUTO_INCREMENT,
`T_date` int(11) DEFAULT NULL,
`T_forum` int(11) DEFAULT NULL,
`T_user` int(11) DEFAULT NULL,
`T_subject` varchar(128) DEFAULT NULL,
`T_type` int(11) DEFAULT NULL,
`T_status` int(11) DEFAULT NULL,
PRIMARY KEY (`T_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `topics`
--
LOCK TABLES `topics` WRITE;
/*!40000 ALTER TABLE `topics` DISABLE KEYS */;
INSERT INTO `topics` VALUES (1,1586175502,1,1,'Test Forum Post',NULL,NULL);
/*!40000 ALTER TABLE `topics` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `userRoles`
--
DROP TABLE IF EXISTS `userRoles`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `userRoles` (
`UR_id` int(11) NOT NULL AUTO_INCREMENT,
`UR_desc` varchar(128) DEFAULT NULL,
`UR_color` varchar(7) NOT NULL,
PRIMARY KEY (`UR_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `userRoles`
--
LOCK TABLES `userRoles` WRITE;
/*!40000 ALTER TABLE `userRoles` DISABLE KEYS */;
INSERT INTO `userRoles` VALUES (1,'User','#000000'),(2,'Admin','#0f00ff'),(3,'Banned','#FF0000');
/*!40000 ALTER TABLE `userRoles` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
`U_id` int(11) NOT NULL AUTO_INCREMENT,
`U_name` varchar(30) DEFAULT NULL,
`U_email` varchar(100) DEFAULT NULL,
`U_password` varchar(255) NOT NULL DEFAULT '',
`U_userLevel` int(1) DEFAULT NULL,
`U_status` int(1) DEFAULT NULL,
PRIMARY KEY (`U_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `users`
--
LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'cday','chris@cdcoding.com','c5cd110b619e8f9761da4577134fdb10443d814570d63e8c442e3279b201f286',2,1);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `userStats`
--
DROP TABLE IF EXISTS `userStats`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `userStats` (
`US_id` int(11) NOT NULL,
`US_street` varchar(255) NOT NULL DEFAULT '',
`US_line2` varchar(255) NOT NULL DEFAULT '',
`US_city` varchar(255) NOT NULL DEFAULT '',
`US_county` varchar(255) NOT NULL DEFAULT '',
`US_postcode` varchar(255) NOT NULL DEFAULT '',
`US_billStreet` varchar(255) NOT NULL DEFAULT '',
`US_billLine2` varchar(255) NOT NULL DEFAULT '',
`US_billCity` varchar(255) NOT NULL DEFAULT '',
`US_billCounty` varchar(255) NOT NULL DEFAULT '',
`US_billPostcode` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`US_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `userStats`
--
LOCK TABLES `userStats` WRITE;
/*!40000 ALTER TABLE `userStats` DISABLE KEYS */;
INSERT INTO `userStats` VALUES (1,'58 Wildfield Close','Wood Street Village','Guildford','Surrey','GU3 3EQ','58 Wildfield Close','Wood Street Village','Guildford','Surrey','GU3 3EQ');
/*!40000 ALTER TABLE `userStats` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `userTimers`
--
DROP TABLE IF EXISTS `userTimers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `userTimers` (
`UT_user` int(11) NOT NULL DEFAULT '0',
`UT_desc` varchar(32) DEFAULT NULL,
`UT_time` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `userTimers`
--
LOCK TABLES `userTimers` WRITE;
/*!40000 ALTER TABLE `userTimers` DISABLE KEYS */;
INSERT INTO `userTimers` VALUES (1,'signup',1586106753),(1,'laston',1586284884),(1,'forumMute',1586175501),(1,'forumTopic',1586175562);
/*!40000 ALTER TABLE `userTimers` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-04-07 19:44:09
| 32.527311 | 431 | 0.700833 |
bff2ea677a3ae532183518aa0017c482ad06b9be
| 981 |
asm
|
Assembly
|
programs/oeis/083/A083254.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | 1 |
2021-03-15T11:38:20.000Z
|
2021-03-15T11:38:20.000Z
|
programs/oeis/083/A083254.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
programs/oeis/083/A083254.asm
|
jmorken/loda
|
99c09d2641e858b074f6344a352d13bc55601571
|
[
"Apache-2.0"
] | null | null | null |
; A083254: a(n) = 2*phi(n) - n.
; 1,0,1,0,3,-2,5,0,3,-2,9,-4,11,-2,1,0,15,-6,17,-4,3,-2,21,-8,15,-2,9,-4,27,-14,29,0,7,-2,13,-12,35,-2,9,-8,39,-18,41,-4,3,-2,45,-16,35,-10,13,-4,51,-18,25,-8,15,-2,57,-28,59,-2,9,0,31,-26,65,-4,19,-22,69,-24,71,-2,5,-4,43,-30,77,-16,27,-2,81,-36,43,-2,25,-8,87,-42,53,-4,27,-2,49,-32,95,-14,21,-20,99,-38,101,-8,-9,-2,105,-36,107,-30,33,-16,111,-42,61,-4,27,-2,73,-56,99,-2,37,-4,75,-54,125,0,39,-34,129,-52,83,-2,9,-8,135,-50,137,-44,43,-2,97,-48,79,-2,21,-4,147,-70,149,-8,39,-34,85,-60,155,-2,49,-32,103,-54,161,-4,-5,-2,165,-72,143,-42,45,-4,171,-62,65,-16,55,-2,177,-84,179,-38,57,-8,103,-66,133,-4,27,-46,189,-64,191,-2,-3,-28,195,-78,197,-40,63,-2,133,-76,115,-2,57,-16,151,-114,209,-4,67,-2,121,-72,143,-2,69,-60,163,-78,221,-32,15,-2,225,-84,227,-54,9,-8,231,-90,133,-4,75,-46,237,-112,239,-22,81,-4,91,-86,185,-8,79,-50
mov $1,$0
cal $1,10 ; Euler totient function phi(n): count numbers <= n and prime to n.
sub $0,$1
sub $1,$0
sub $1,1
| 109 | 830 | 0.557594 |
db26e9c798f706d6c99cd0c81833e618aed1bcb1
| 1,100 |
sql
|
SQL
|
coffee-shop/database/create-tables.sql
|
fajes650yqu0n/PacktPublishingn
|
709f84fb37610abf23ca498a25364cdaf073ac8d
|
[
"MIT"
] | 20 |
2018-07-03T22:43:53.000Z
|
2021-11-08T13:12:16.000Z
|
coffee-shop/database/create-tables.sql
|
fajes650yqu0n/PacktPublishingn
|
709f84fb37610abf23ca498a25364cdaf073ac8d
|
[
"MIT"
] | 1 |
2018-06-27T11:11:43.000Z
|
2018-06-27T11:11:43.000Z
|
coffee-shop/database/create-tables.sql
|
PacktPublishing/Developing-Containerized-Java-EE-8-Apps-using-Docker-and-Kubernetes
|
74e51b3c464c24bf9a1bbb3f7f4ef6df46578a84
|
[
"MIT"
] | 13 |
2018-09-07T04:14:42.000Z
|
2021-08-22T16:37:09.000Z
|
--
-- create tables
CREATE TABLE orders (
id VARCHAR(255) NOT NULL,
status VARCHAR(255) NOT NULL,
type VARCHAR(255) NOT NULL,
origin_name VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE origin_coffee_types (
origin_name VARCHAR(255) NOT NULL,
type VARCHAR(255) NOT NULL,
PRIMARY KEY (origin_name, type)
);
CREATE TABLE origins (
name VARCHAR(255) NOT NULL,
PRIMARY KEY (name)
);
ALTER TABLE orders
ADD CONSTRAINT FKt474abpx5pxojjm61tb1d64vp FOREIGN KEY (origin_name) REFERENCES origins;
ALTER TABLE origin_coffee_types
ADD CONSTRAINT FKik7slqd5hcdp9kwh6vukqtfli FOREIGN KEY (origin_name) REFERENCES origins;
--
-- insert data
INSERT INTO origins VALUES ('Ethiopia');
INSERT INTO origin_coffee_types VALUES ('Ethiopia', 'ESPRESSO');
INSERT INTO origin_coffee_types VALUES ('Ethiopia', 'LATTE');
INSERT INTO origin_coffee_types VALUES ('Ethiopia', 'POUR_OVER');
INSERT INTO origins VALUES ('Colombia');
INSERT INTO origin_coffee_types VALUES ('Colombia', 'ESPRESSO');
INSERT INTO origin_coffee_types VALUES ('Colombia', 'POUR_OVER');
| 27.5 | 90 | 0.741818 |
aa45d260dafc382fd545599f83efb30aa1e2d0ca
| 249 |
sql
|
SQL
|
kata-files/lesson2/postgresql/expected/MYLARGESCHEMA/view/view3.sql
|
goldmansachs/obevo-kata
|
5596ff44ad560d89d183ac0941b727db1a2a7346
|
[
"Apache-2.0"
] | 22 |
2017-09-28T21:35:04.000Z
|
2022-02-12T06:24:28.000Z
|
kata-files/lesson2/postgresql/expected/MYLARGESCHEMA/view/view3.sql
|
goldmansachs/obevo-kata
|
5596ff44ad560d89d183ac0941b727db1a2a7346
|
[
"Apache-2.0"
] | 6 |
2017-07-01T13:52:34.000Z
|
2018-09-13T15:43:47.000Z
|
kata-files/lesson2/postgresql/expected/MYLARGESCHEMA/view/view3.sql
|
goldmansachs/obevo-kata
|
5596ff44ad560d89d183ac0941b727db1a2a7346
|
[
"Apache-2.0"
] | 11 |
2017-04-30T18:39:09.000Z
|
2021-08-22T16:21:11.000Z
|
CREATE VIEW view3 AS
SELECT 1 AS c1
FROM table116
UNION
SELECT 1 AS c1
FROM table279
UNION
SELECT 1 AS c1
FROM table100
UNION
SELECT 1 AS c1
FROM view70
UNION
SELECT 1 AS c1
FROM view52
UNION
SELECT 1 AS c1
FROM view86;
GO
| 11.318182 | 20 | 0.706827 |
98c8460b9b4e6efb36207ee96a0911661d101fa1
| 2,892 |
html
|
HTML
|
docs/2020-12-1-146/readings/notes/jones_reckoning_with_matter.html
|
periode/thesis
|
84a3e5631455f165634ad8f9b977d2e90f4f2a8a
|
[
"MIT"
] | 2 |
2020-12-27T23:08:47.000Z
|
2021-06-04T02:54:09.000Z
|
docs/2020-12-1-146/readings/notes/jones_reckoning_with_matter.html
|
periode/thesis
|
84a3e5631455f165634ad8f9b977d2e90f4f2a8a
|
[
"MIT"
] | null | null | null |
docs/2020-12-1-146/readings/notes/jones_reckoning_with_matter.html
|
periode/thesis
|
84a3e5631455f165634ad8f9b977d2e90f4f2a8a
|
[
"MIT"
] | null | null | null |
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>works in public</title>
<link rel="stylesheet" href="style.css"/>
</head>
<body>
<style>
body {
background-color: white;
font-family: sans-serif, serif;
}
.holding{
margin: auto;
}
.tight{
width: 70%;
}
.way {
position: absolute;
top: 10px;
left: 10px;
}
</style>
<div class="way">
<a href="/index.html">cover</a>
</div>
<div class="holding tight">
<h1 id="reckoning-with-matter">reckoning with matter</h1>
<h2 id="matthew-l-jones">matthew l. jones</h2>
<h3 id="university-of-chicago-press-2016">university of chicago press, 2016</h3>
<hr />
<p>the book is about the development of calculating machines by “philosophers-inventors” (e.g. pascal, leibniz, and babbage). this is particularly interesting for me in regards to the history of craftsmanship and the relationship between the inventor and the artisan.</p>
<hr />
<h4 id="introduction">introduction</h4>
<p>there are two models to invention: the deterministic, cumulative one (bottom up), and the individual, heroic one (top-down). the third way is that of <strong>techne</strong>, skilled making, between imitation and originality, the social and the individual, and no absolute split between design and production (agile development!)</p>
<p>the interesting phrase of <em>handy mind and mindful hand</em> (cf. roberts, shaffer, dean, 2017)</p>
<p>the artisanal knowledge involved in making calculating machines are:</p>
<ul>
<li>propositional knowledge: gained through long-term experience of working with materials (not always explicitly cognized, e.g. properties of materials, etc.)</li>
<li>discernmentm or the acuity of senses in making judgment about perceptions</li>
<li>dexterity in doing work with hands (after long-term experience with materials)</li>
<li>knowledge of the social world where other skills could be found</li>
</ul>
<p>artisanal labor has both mimetic and creative aspects. and the financial compensation should take both into account</p>
<p>there was difficulty between leibniz and olliver to accurately communicate theoretically before the age of standardized written and pictorial comunication practices in engineering.</p>
<p>diferent styles of technical drawings and description imply and accompany different conceptions and organizations of intellect and labor. more specified regulate production, less specified imply the need for the discretion and competence of the producers.</p>
<p>leibniz recognized that philosophers had to rely on the “confused” (implicit, tacit) knowledge of artisans; which he also relates to artists (knowing a beautiful painting)</p>
<p>craftsmanship of risk vs. craftsmanship of certainty (pye, 1968 <em>the nature and art of workmanship</em>)</p>
</div>
</body>
</html>
| 39.081081 | 336 | 0.72787 |
9baaff69d1d21a5ac53edd2eac42e665f7c553e8
| 3,634 |
js
|
JavaScript
|
src/res/js/under/extend/stage/physics/VariableGravityWorld.js
|
Expine/Under
|
8c9f2b884b1a8ce4bdf2fff948cac4cebbd5fdc3
|
[
"MIT"
] | null | null | null |
src/res/js/under/extend/stage/physics/VariableGravityWorld.js
|
Expine/Under
|
8c9f2b884b1a8ce4bdf2fff948cac4cebbd5fdc3
|
[
"MIT"
] | null | null | null |
src/res/js/under/extend/stage/physics/VariableGravityWorld.js
|
Expine/Under
|
8c9f2b884b1a8ce4bdf2fff948cac4cebbd5fdc3
|
[
"MIT"
] | null | null | null |
// TODO: Comment
/**
* Gravity world
* - Performs a physical operation
* - Registers entities and apply a physical operation
* - Continually perform collision processing
* - ### Manages not actor by split area
* @extends {SplitWorld}
* @classdesc Gravity world to manage not actor by split area
*/
class VariableGravityWorld extends SplitWorld { // eslint-disable-line no-unused-vars
/**
* Gravity world constructor
* @constructor
* @param {number} stageWidth Stage width (pixel)
* @param {number} stageHeight Stage height (pixel)
* @param {number} [gravity=9.8] gravity of the world
*/
constructor(stageWidth, stageHeight, gravity = 9.8) {
super(stageWidth, stageHeight, gravity);
/**
* Gravity x direction
* @protected
* @param {number}
*/
this.gravityX = 0;
/**
* Gravity y direction
* @protected
* @param {number}
*/
this.gravityY = 1;
this.gravityXs = [];
this.gravityYs = [];
this.deltas = [];
this.number = 0;
}
/**
* Add gravity change time
* @param {number} gravityX Gravity x direction
* @param {number} gravityY Gravity y direction
* @param {number} delta Delta time
*/
addGravity(gravityX, gravityY, delta) {
this.gravityXs.push(gravityX);
this.gravityYs.push(gravityY);
this.deltas.push(delta);
}
/**
* Update external force
* @protected
* @override
* @param {number} dt Delta time
*/
updateExternalForce(dt) {
if (this.deltas[this.number] < 0) {
this.number++;
}
if (this.number < this.deltas.length) {
this.gravityX = this.gravityXs[this.number];
this.gravityY = this.gravityYs[this.number];
this.deltas[this.number] -= dt / 1000;
if (this.deltas[this.number] < 1) {
this.gravityX = 0;
this.gravityY = 1;
}
}
for (const target of this.actors) {
if (target.body !== null) {
const g = this.gravity * target.material.mass * target.body.material.gravityScale;
target.body.enforce(g * this.gravityX, g * this.gravityY);
}
}
}
/**
* Render world
* @abstract
* @param {Context} ctx Canvas context
* @param {number} [shiftX = 0] Shift x position
* @param {number} [shiftY = 0] Shift y position
*/
render(ctx, shiftX = 0, shiftY = 0) {
if (this.number < this.deltas.length) {
const delta = this.deltas[this.number];
if (delta < 1 && Math.floor(delta * 1000) % 2 === 0) {
if (this.number < this.deltas.length - 1) {
const x = this.gravityXs[this.number + 1];
const y = this.gravityYs[this.number + 1];
if (x > 0) {
ctx.fillText(`>`, GameScreen.it.width - 10, GameScreen.it.height / 2, 1.0, 0.5, 100, `red`);
}
if (x < 0) {
ctx.fillText(`<`, 10, GameScreen.it.height / 2, 0.0, 0.5, 100, `red`);
}
if (y > 0) {
ctx.fillText(`|`, GameScreen.it.width / 2, GameScreen.it.height - 10, 0.5, 1.0, 100, `red`);
}
if (y < 0) {
ctx.fillText(`^`, GameScreen.it.width / 2, 10, 0.5, 0.0, 100, `red`);
}
}
}
}
}
}
| 32.159292 | 116 | 0.504953 |
a1218f179279b8474798c2d3b4a293887517a34f
| 278 |
swift
|
Swift
|
ios/RCTMGL-v10/RCTMGLMarkerViewManager.swift
|
NorthroomZA/maps
|
d35760d38fc578969e3f4cb5b6c7f02af3e7d518
|
[
"MIT"
] | 36 |
2022-03-01T01:31:13.000Z
|
2022-03-29T23:11:29.000Z
|
ios/RCTMGL-v10/RCTMGLMarkerViewManager.swift
|
NorthroomZA/maps
|
d35760d38fc578969e3f4cb5b6c7f02af3e7d518
|
[
"MIT"
] | 61 |
2022-03-01T00:00:59.000Z
|
2022-03-28T15:53:28.000Z
|
ios/RCTMGL-v10/RCTMGLMarkerViewManager.swift
|
NorthroomZA/maps
|
d35760d38fc578969e3f4cb5b6c7f02af3e7d518
|
[
"MIT"
] | 21 |
2022-03-02T08:50:37.000Z
|
2022-03-31T02:07:30.000Z
|
import Foundation
import MapboxMaps
@objc(RCTMGLMarkerViewManager)
class RCTMGLMarkerViewManager : RCTViewManager {
@objc
override static func requiresMainQueueSetup() -> Bool {
return true
}
override func view() -> UIView! {
return RCTMGLMarkerView()
}
}
| 18.533333 | 57 | 0.730216 |
450ce83545b6aa102a013482089c82d9a980885a
| 2,092 |
swift
|
Swift
|
box/View/GridVisorMatch/VGridVisorMatch.swift
|
grandiere/box
|
72c9848017e2fed2b8358e2f52edbc8d21f1a4f0
|
[
"MIT"
] | 7 |
2017-05-17T15:11:53.000Z
|
2020-10-14T14:54:52.000Z
|
box/View/GridVisorMatch/VGridVisorMatch.swift
|
grandiere/box
|
72c9848017e2fed2b8358e2f52edbc8d21f1a4f0
|
[
"MIT"
] | 22 |
2017-05-16T15:43:08.000Z
|
2018-02-26T07:11:18.000Z
|
box/View/GridVisorMatch/VGridVisorMatch.swift
|
grandiere/box
|
72c9848017e2fed2b8358e2f52edbc8d21f1a4f0
|
[
"MIT"
] | 7 |
2017-05-17T15:12:02.000Z
|
2020-09-09T13:15:44.000Z
|
import UIKit
class VGridVisorMatch:VView
{
private(set) weak var buttonCancel:UIButton!
private(set) weak var viewBase:VGridVisorMatchBase!
private weak var controller:CGridVisorMatch!
private weak var layoutBaseTop:NSLayoutConstraint!
private let kBaseMarginHorizontal:CGFloat = 10
private let kBaseHeight:CGFloat = 180
override init(controller:CController)
{
super.init(controller:controller)
backgroundColor = UIColor.clear
self.controller = controller as? CGridVisorMatch
let viewBase:VGridVisorMatchBase = VGridVisorMatchBase(
controller:self.controller)
self.viewBase = viewBase
let buttonCancel:UIButton = UIButton()
buttonCancel.backgroundColor = UIColor.clear
buttonCancel.translatesAutoresizingMaskIntoConstraints = false
buttonCancel.clipsToBounds = true
buttonCancel.addTarget(
self,
action:#selector(actionCancel(sender:)),
for:UIControlEvents.touchUpInside)
self.buttonCancel = buttonCancel
addSubview(buttonCancel)
addSubview(viewBase)
NSLayoutConstraint.equals(
view:buttonCancel,
toView:self)
layoutBaseTop = NSLayoutConstraint.topToTop(
view:viewBase,
toView:self)
NSLayoutConstraint.height(
view:viewBase,
constant:kBaseHeight)
NSLayoutConstraint.equalsHorizontal(
view:viewBase,
toView:self,
margin:kBaseMarginHorizontal)
}
required init?(coder:NSCoder)
{
return nil
}
override func layoutSubviews()
{
let height:CGFloat = bounds.maxY
let remainHeight:CGFloat = height - kBaseHeight
let marginTop:CGFloat = remainHeight / 2.0
layoutBaseTop.constant = marginTop
super.layoutSubviews()
}
//MARK: actions
func actionCancel(sender button:UIButton)
{
controller.back()
}
}
| 28.657534 | 70 | 0.632887 |
6cec2c466ac73fb70774aa0021f3c36454c27f28
| 4,335 |
lua
|
Lua
|
KkthnxUI/Modules/Maps/Minimap.lua
|
Bia10/KkthnxUI-3.3.5
|
028503de668fd6f216022c59983558aec37f4dde
|
[
"FSFAP"
] | 1 |
2021-04-30T05:19:54.000Z
|
2021-04-30T05:19:54.000Z
|
KkthnxUI/Modules/Maps/Minimap.lua
|
Bia10/KkthnxUI-3.3.5
|
028503de668fd6f216022c59983558aec37f4dde
|
[
"FSFAP"
] | null | null | null |
KkthnxUI/Modules/Maps/Minimap.lua
|
Bia10/KkthnxUI-3.3.5
|
028503de668fd6f216022c59983558aec37f4dde
|
[
"FSFAP"
] | 1 |
2021-12-07T14:10:56.000Z
|
2021-12-07T14:10:56.000Z
|
local K, C, L, _ = unpack(select(2, ...))
if C["minimap"].enable ~= true then return end
local _G = _G
local unpack = unpack
local pairs = pairs
local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent
local IsAddOnLoaded = IsAddOnLoaded
-- Minimap border
local MinimapAnchor = CreateFrame("Frame", "MinimapAnchor", UIParent)
MinimapAnchor:CreatePanel("Invisible", C["minimap"].size, C["minimap"].size, unpack(C["position"].minimap))
local frames = {
"GameTimeFrame",
"MinimapBorder",
"MinimapZoomIn",
"MinimapZoomOut",
"MinimapBorderTop",
"BattlegroundShine",
"MiniMapWorldMapButton",
"MinimapZoneTextButton",
"MiniMapTrackingBackground",
"MiniMapVoiceChatFrameBackground",
"MiniMapVoiceChatFrameBorder",
"MiniMapVoiceChatFrame",
"MinimapNorthTag",
"MiniMapBattlefieldBorder",
"MiniMapMailBorder",
"MiniMapTracking",
}
for i in pairs(frames) do
_G[frames[i]]:Hide()
_G[frames[i]].Show = K.Dummy
end
-- Kill Minimap Cluster
MinimapCluster:Kill()
-- Parent Minimap into our frame
Minimap:SetParent(MinimapAnchor)
Minimap:ClearAllPoints()
Minimap:SetPoint("TOPLEFT", MinimapAnchor, "TOPLEFT", 0, 0)
Minimap:SetPoint("BOTTOMRIGHT", MinimapAnchor, "BOTTOMRIGHT", 0, 0)
Minimap:SetSize(MinimapAnchor:GetWidth(), MinimapAnchor:GetWidth())
-- Backdrop
MinimapBackdrop:ClearAllPoints()
MinimapBackdrop:SetPoint("TOPLEFT", MinimapAnchor, "TOPLEFT", 2, -2)
MinimapBackdrop:SetPoint("BOTTOMRIGHT", MinimapAnchor, "BOTTOMRIGHT", -2, 2)
MinimapBackdrop:SetSize(MinimapAnchor:GetWidth(), MinimapAnchor:GetWidth())
-- Mail
MiniMapMailFrame:ClearAllPoints()
MiniMapMailFrame:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, 5)
MiniMapMailFrame:SetScale(1.2)
MiniMapMailIcon:SetTexture('Interface\\Addons\\KkthnxUI\\Media\\Textures\\Mail')
MiniMapBattlefieldFrame:ClearAllPoints()
MiniMapBattlefieldFrame:SetPoint("TOP", Minimap, "TOP", 1, 1)
MiniMapInstanceDifficulty:ClearAllPoints()
MiniMapInstanceDifficulty:SetParent(Minimap)
MiniMapInstanceDifficulty:SetPoint("TOPRIGHT", Minimap, "TOPRIGHT", 3, 2)
-- Invites icon
GameTimeCalendarInvitesTexture:ClearAllPoints()
GameTimeCalendarInvitesTexture:SetParent(Minimap)
GameTimeCalendarInvitesTexture:SetPoint("TOPRIGHT")
-- Default LFG icon
local function UpdateLFG()
MiniMapLFGFrame:ClearAllPoints()
MiniMapLFGFrame:SetPoint("TOP", Minimap, "TOP", 1, 6)
MiniMapLFGFrame:SetHighlightTexture(nil)
MiniMapLFGFrameBorder:Kill()
end
hooksecurefunc("MiniMapLFG_UpdateIsShown", UpdateLFG)
-- Enable mouse scrolling
Minimap:EnableMouseWheel(true)
Minimap:SetScript("OnMouseWheel", function(self, d)
if d > 0 then
_G.MinimapZoomIn:Click()
elseif d < 0 then
_G.MinimapZoomOut:Click()
end
end)
-- ClockFrame
if not IsAddOnLoaded("Blizzard_TimeManager") then
LoadAddOn("Blizzard_TimeManager")
end
local ClockFrame, ClockTime = TimeManagerClockButton:GetRegions()
ClockFrame:Hide()
ClockTime:SetFont(C["font"].basic_font, C["font"].basic_font_size, C["font"].basic_font_style)
ClockTime:SetShadowOffset(0, 0)
TimeManagerClockButton:ClearAllPoints()
TimeManagerClockButton:SetPoint("BOTTOM", Minimap, "BOTTOM", 0, -5)
TimeManagerClockButton:SetScript('OnShow', nil)
TimeManagerClockButton:Hide()
TimeManagerClockButton:SetScript('OnClick', function(self, button)
if(button == "RightButton") then
if(self.alarmFiring) then
PlaySound('igMainMenuQuit')
TimeManager_TurnOffAlarm()
else
ToggleTimeManager()
end
else
ToggleCalendar()
end
end)
-- For others mods with a minimap button, set minimap buttons position in square mode.
function GetMinimapShape() return 'SQUARE' end
-- Set Boarder Texture
MinimapBackdrop:SetBackdrop(K.Backdrop)
MinimapBackdrop:ClearAllPoints()
MinimapBackdrop:SetBackdropBorderColor(unpack(C["media"].border_color))
MinimapBackdrop:SetBackdropColor(0.05, 0.05, 0.05, 0.0)
MinimapBackdrop:SetPoint("TOPLEFT", Minimap, "TOPLEFT", -4, 4)
MinimapBackdrop:SetPoint("BOTTOMRIGHT", Minimap, "BOTTOMRIGHT", 4, -4)
if C["minimap"].classcolor ~= false then
MinimapBackdrop:SetBackdropBorderColor(K.Color.r, K.Color.g, K.Color.b)
elseif C["blizzard"].dark_textures == true then
MinimapBackdrop:SetBackdropBorderColor(unpack(C["blizzard"].dark_textures_color))
else
MinimapBackdrop:SetBackdropBorderColor(unpack(C["media"].border_color))
end
-- Set Square Map View
Minimap:SetMaskTexture(C["media"].blank)
MinimapBorder:Hide()
| 32.111111 | 107 | 0.785236 |
bab7af2f0e03f7461ccc4f683ef6e0c28acbef97
| 261 |
swift
|
Swift
|
Package.swift
|
azawawi/swift-zmq-examples
|
0fd55373ece3c1a400460dff7cca51401e35d0e8
|
[
"MIT"
] | 3 |
2016-10-03T08:22:27.000Z
|
2018-11-14T15:58:32.000Z
|
Package.swift
|
azawawi/swift-zmq-examples
|
0fd55373ece3c1a400460dff7cca51401e35d0e8
|
[
"MIT"
] | null | null | null |
Package.swift
|
azawawi/swift-zmq-examples
|
0fd55373ece3c1a400460dff7cca51401e35d0e8
|
[
"MIT"
] | 1 |
2018-11-14T15:58:35.000Z
|
2018-11-14T15:58:35.000Z
|
import PackageDescription
let package = Package(
name: "ZMQExamples",
dependencies: [
.Package(
url : "https://github.com/azawawi/swift-zmq.git",
majorVersion : 0,
minor : 4
)
]
)
| 20.076923 | 70 | 0.494253 |
fb11b44f4e120f6b7293847da1e0e9f0133f853a
| 1,649 |
go
|
Go
|
app/bitcoin/transaction/build/poll.go
|
tracyspacy/memo
|
3caf6c2c0f18086a528999ab14c32155589074ac
|
[
"MIT"
] | null | null | null |
app/bitcoin/transaction/build/poll.go
|
tracyspacy/memo
|
3caf6c2c0f18086a528999ab14c32155589074ac
|
[
"MIT"
] | null | null | null |
app/bitcoin/transaction/build/poll.go
|
tracyspacy/memo
|
3caf6c2c0f18086a528999ab14c32155589074ac
|
[
"MIT"
] | 1 |
2019-11-12T23:33:52.000Z
|
2019-11-12T23:33:52.000Z
|
package build
import (
"github.com/jchavannes/jgo/jerr"
"github.com/memocash/memo/app/bitcoin/memo"
"github.com/memocash/memo/app/bitcoin/wallet"
"github.com/memocash/memo/app/db"
"sort"
)
func Poll(pollType memo.PollType, question string, options []string, privateKey *wallet.PrivateKey) ([]*memo.Tx, error) {
var outputType memo.OutputType
switch memo.PollType(pollType) {
case memo.PollTypeOne:
outputType = memo.OutputTypeMemoPollQuestionSingle
case memo.PollTypeAny:
outputType = memo.OutputTypeMemoPollQuestionMulti
default:
return nil, jerr.New("invalid poll type")
}
spendableTxOuts, err := db.GetSpendableTransactionOutputsForPkHash(privateKey.GetPublicKey().GetAddress().GetScriptAddress())
if err != nil {
return nil, jerr.Get("error getting spendable tx outs", err)
}
sort.Sort(db.TxOutSortByValue(spendableTxOuts))
var memoTxns []*memo.Tx
memoTx, spendableTxOuts, err := buildWithTxOuts([]memo.Output{{
Type: outputType,
Data: []byte(question),
RefData: []byte{byte(len(options))},
}}, spendableTxOuts, privateKey)
if err != nil {
return nil, jerr.Get("error creating tx", err)
}
memoTxns = append(memoTxns, memoTx)
memoTxHash := memoTx.MsgTx.TxHash()
var questionTxHashBytes = memoTxHash.CloneBytes()
for _, option := range options {
memoTx, spendableTxOuts, err = buildWithTxOuts([]memo.Output{{
Type: memo.OutputTypeMemoPollOption,
Data: []byte(option),
RefData: []byte(questionTxHashBytes),
}}, spendableTxOuts, privateKey)
if err != nil {
return nil, jerr.Get("error creating tx", err)
}
memoTxns = append(memoTxns, memoTx)
}
return memoTxns, nil
}
| 29.981818 | 126 | 0.730139 |
cb8ef700df14e74ec7235f8d60b33a7a0239854b
| 3,275 |
go
|
Go
|
conv32_test.go
|
sirkon/decconv
|
4d07560f2c6d19d59702db9105000b4201583702
|
[
"MIT"
] | null | null | null |
conv32_test.go
|
sirkon/decconv
|
4d07560f2c6d19d59702db9105000b4201583702
|
[
"MIT"
] | null | null | null |
conv32_test.go
|
sirkon/decconv
|
4d07560f2c6d19d59702db9105000b4201583702
|
[
"MIT"
] | null | null | null |
package decconv
import (
"testing"
)
func TestDecode32(t *testing.T) {
type args struct {
precision int
scale int
input string
}
tests := []struct {
name string
args args
want int32
conv string
wantErr bool
}{
{
name: "only-integral-positive",
args: args{
precision: 9,
scale: 0,
input: "12",
},
want: 12,
conv: "12",
wantErr: false,
},
{
name: "only-integral-negative",
args: args{
precision: 9,
scale: 0,
input: "-123",
},
want: -123,
conv: "-123",
wantErr: false,
},
{
name: "generic-empty-fraction",
args: args{
precision: 9,
scale: 1,
input: "12.0",
},
want: 120,
conv: "12",
wantErr: false,
},
{
name: "generic-empty-fraction",
args: args{
precision: 9,
scale: 2,
input: "12.02",
},
want: 1202,
conv: "12.02",
wantErr: false,
},
{
name: "check-input-positive",
args: args{
precision: 9,
scale: 5,
input: "3015.07654",
},
want: 301507654,
conv: "3015.07654",
wantErr: false,
},
{
name: "check-input-negative",
args: args{
precision: 9,
scale: 5,
input: "-3015.07654",
},
want: -301507654,
conv: "-3015.07654",
wantErr: false,
},
{
name: "passing-leading-zeroes",
args: args{
precision: 9,
scale: 2,
input: "0000123.25",
},
want: 12325,
conv: "123.25",
wantErr: false,
},
{
name: "passing-trailing-zeroes",
args: args{
precision: 9,
scale: 3,
input: "123.02500000000000",
},
want: 123025,
conv: "123.025",
wantErr: false,
},
{
name: "passing-both-sides-zeroes",
args: args{
precision: 9,
scale: 4,
input: "-0000000123.12300000000",
},
want: -1231230,
conv: "-123.123",
wantErr: false,
},
{
name: "error-empty-input",
args: args{
precision: 9,
scale: 4,
input: "",
},
want: 0,
wantErr: true,
},
{
name: "error-invalid-input-integral-part",
args: args{
precision: 9,
scale: 4,
input: "1A2.3",
},
want: 0,
wantErr: true,
},
{
name: "error-invalid-input-fraction-part",
args: args{
precision: 9,
scale: 4,
input: "12.b3",
},
want: 0,
wantErr: true,
},
{
name: "error-overflow-integral",
args: args{
precision: 9,
scale: 6,
input: "1234.12",
},
want: 0,
wantErr: true,
},
{
name: "error-overflow-fraction",
args: args{
precision: 9,
scale: 3,
input: "1234.1234",
},
want: 0,
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := Decode32(tt.args.precision, tt.args.scale, []byte(tt.args.input))
if (err != nil) != tt.wantErr {
t.Errorf("Decode32() error = %v, wantErr %v", err, tt.wantErr)
return
}
if got != tt.want {
t.Errorf("Decode32() = %v, want %v", got, tt.want)
}
if conv := Encode32(tt.args.scale, got); conv != tt.conv && err == nil {
t.Errorf("Encode32() = %v, want %v", conv, tt.conv)
}
})
}
}
| 17.607527 | 80 | 0.500458 |
cb891795178501e35c9de1ce97221c22b594435c
| 465 |
go
|
Go
|
vendor/github.com/mkideal/log/_examples/console/main.go
|
kooksee/ksuv
|
b9dafc8370ad6f56f25a8f8810d53b1908bc65fd
|
[
"MIT"
] | 48 |
2016-08-13T15:36:04.000Z
|
2020-11-24T07:05:04.000Z
|
vendor/github.com/mkideal/log/_examples/console/main.go
|
kooksee/ksuv
|
b9dafc8370ad6f56f25a8f8810d53b1908bc65fd
|
[
"MIT"
] | 1 |
2017-05-12T07:51:10.000Z
|
2017-05-12T08:54:01.000Z
|
vendor/github.com/mkideal/log/_examples/console/main.go
|
kooksee/ksuv
|
b9dafc8370ad6f56f25a8f8810d53b1908bc65fd
|
[
"MIT"
] | 9 |
2016-08-13T10:26:09.000Z
|
2018-06-29T06:57:25.000Z
|
package main
import (
"github.com/mkideal/log"
)
func main() {
defer log.Uninit(log.InitConsole(log.LvWARN))
log.SetLevel(log.LvDEBUG)
log.Trace("%s cannot be printed", "TRACE")
log.Debug("%s should be printed into stdout", "DEBUG")
log.Info("%s should be printed into stdout", "INFO")
log.Warn("%s should be printed into stderr", "WARN")
log.Error("%s should be printed into stderr", "ERROR")
log.Fatal("%s should be printed into stderr", "FATAL")
}
| 23.25 | 55 | 0.692473 |
e952d53d6ddaab9401269965b9305a7c8c0eede6
| 194 |
rb
|
Ruby
|
db/migrate/20140610105752_add_to_updated_at_pq_ao.rb
|
saydulk/parliamentary-questions
|
5a287b2886010c587c0e15499fd6b90cfa509dcc
|
[
"MIT"
] | null | null | null |
db/migrate/20140610105752_add_to_updated_at_pq_ao.rb
|
saydulk/parliamentary-questions
|
5a287b2886010c587c0e15499fd6b90cfa509dcc
|
[
"MIT"
] | null | null | null |
db/migrate/20140610105752_add_to_updated_at_pq_ao.rb
|
saydulk/parliamentary-questions
|
5a287b2886010c587c0e15499fd6b90cfa509dcc
|
[
"MIT"
] | 15 |
2017-01-12T10:18:11.000Z
|
2019-04-19T08:15:39.000Z
|
class AddToUpdatedAtPqAo < ActiveRecord::Migration
def change
add_column :action_officers_pqs, :updated_at, :datetime
add_column :action_officers_pqs, :created_at, :datetime
end
end
| 27.714286 | 59 | 0.78866 |
8abcccb549281c210e9e467eff48ff3d6a4504ed
| 10,682 |
rs
|
Rust
|
src/lib/codec/codecs/base32.rs
|
bk2204/muter
|
6b36874e79988e84208586a90c414e9cb077545c
|
[
"MIT"
] | 4 |
2021-01-10T10:13:02.000Z
|
2022-03-26T08:38:25.000Z
|
src/lib/codec/codecs/base32.rs
|
bk2204/muter
|
6b36874e79988e84208586a90c414e9cb077545c
|
[
"MIT"
] | 4 |
2017-07-05T08:59:13.000Z
|
2022-01-23T18:20:52.000Z
|
src/lib/codec/codecs/base32.rs
|
bk2204/muter
|
6b36874e79988e84208586a90c414e9cb077545c
|
[
"MIT"
] | 2 |
2017-10-26T10:37:42.000Z
|
2021-12-02T15:02:48.000Z
|
#![allow(unknown_lints)]
#![allow(bare_trait_objects)]
use codec::helpers::codecs::ChunkedDecoder;
use codec::helpers::codecs::PaddedDecoder;
use codec::helpers::codecs::PaddedEncoder;
use codec::helpers::codecs::StatelessEncoder;
use codec::CodecSettings;
use codec::CodecTransform;
use codec::Direction;
use codec::Error;
use codec::TransformableCodec;
use std::cmp;
use std::collections::BTreeMap;
use std::io;
#[derive(Default)]
pub struct Base32TransformFactory {}
#[derive(Default)]
pub struct Base32HexTransformFactory {}
pub const BASE32: [u8; 32] = [
b'A', b'B', b'C', b'D', b'E', b'F', b'G', b'H', b'I', b'J', b'K', b'L', b'M', b'N', b'O', b'P',
b'Q', b'R', b'S', b'T', b'U', b'V', b'W', b'X', b'Y', b'Z', b'2', b'3', b'4', b'5', b'6', b'7',
];
pub const BASE32HEX: [u8; 32] = [
b'0', b'1', b'2', b'3', b'4', b'5', b'6', b'7', b'8', b'9', b'A', b'B', b'C', b'D', b'E', b'F',
b'G', b'H', b'I', b'J', b'K', b'L', b'M', b'N', b'O', b'P', b'Q', b'R', b'S', b'T', b'U', b'V',
];
pub const REV: [i8; 256] = [
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
];
pub const REVHEX: [i8; 256] = [
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, 0, -1, -1, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
];
fn forward_transform(inp: &[u8], outp: &mut [u8], arr: &[u8; 32]) -> (usize, usize) {
let (is, os) = (5, 8);
let bits = is * 8 / os;
let mask = (1u64 << bits) - 1;
let n = cmp::min(inp.len() / is, outp.len() / os);
for (i, j) in (0..n).map(|x| (x * is, x * os)) {
let x: u64 = inp[i..i + is]
.iter()
.enumerate()
.map(|(k, &v)| u64::from(v) << ((is - 1 - k) * 8))
.sum();
for (k, val) in outp[j..j + os].iter_mut().enumerate().take(os) {
*val = arr[(x >> ((os - 1 - k) * bits) & mask) as usize];
}
}
(n * is, n * os)
}
impl Base32TransformFactory {
pub fn new() -> Self {
Base32TransformFactory {}
}
fn factory_for(
name: &'static str,
forward: &'static [u8; 32],
reverse: &'static [i8; 256],
r: Box<io::BufRead>,
s: CodecSettings,
) -> Result<Box<io::BufRead>, Error> {
let pad = match (s.bool_arg("pad")?, s.bool_arg("nopad")?) {
(true, true) => {
return Err(Error::IncompatibleParameters("pad".into(), "nopad".into()))
}
(_, false) => Some(b'='),
(false, true) => None,
};
let codec = match s.dir {
Direction::Forward => PaddedEncoder::new(
StatelessEncoder::new(move |inp, out| forward_transform(inp, out, forward), 8),
5,
8,
pad,
)
.into_bufread(r, s.bufsize),
Direction::Reverse => PaddedDecoder::new(
ChunkedDecoder::new(s.strict, name, 8, 5, reverse),
8,
5,
pad,
)
.into_bufread(r, s.bufsize),
};
Ok(codec)
}
}
impl CodecTransform for Base32TransformFactory {
fn factory(&self, r: Box<io::BufRead>, s: CodecSettings) -> Result<Box<io::BufRead>, Error> {
Base32TransformFactory::factory_for(self.name(), &BASE32, &REV, r, s)
}
fn options(&self) -> BTreeMap<String, String> {
let mut map = BTreeMap::new();
map.insert("pad".to_string(), tr!("pad incomplete sequences with ="));
map.insert(
"nopad".to_string(),
tr!("do not pad incomplete sequences with ="),
);
map
}
fn can_reverse(&self) -> bool {
true
}
fn name(&self) -> &'static str {
"base32"
}
}
impl Base32HexTransformFactory {
pub fn new() -> Self {
Base32HexTransformFactory {}
}
}
impl CodecTransform for Base32HexTransformFactory {
fn factory(&self, r: Box<io::BufRead>, s: CodecSettings) -> Result<Box<io::BufRead>, Error> {
Base32TransformFactory::factory_for(self.name(), &BASE32HEX, &REVHEX, r, s)
}
fn options(&self) -> BTreeMap<String, String> {
let mut map = BTreeMap::new();
map.insert("pad".to_string(), tr!("pad incomplete sequences with ="));
map.insert(
"nopad".to_string(),
tr!("do not pad incomplete sequences with ="),
);
map
}
fn can_reverse(&self) -> bool {
true
}
fn name(&self) -> &'static str {
"base32hex"
}
}
#[cfg(test)]
mod tests {
use chain::Chain;
use codec::registry::CodecRegistry;
use codec::tests;
fn check(name: &str, inp: &[u8], outp: &[u8]) {
let reg = CodecRegistry::new();
for i in vec![5, 6, 7, 8, 512] {
let c = Chain::new(®, name, i, true);
assert_eq!(c.transform(inp.to_vec()).unwrap(), outp);
}
let rev = format!("-{}", name);
for i in vec![8, 9, 10, 11, 512] {
let c = Chain::new(®, &rev, i, true);
assert_eq!(c.transform(outp.to_vec()).unwrap(), inp);
let c = Chain::new(®, &rev, i, false);
assert_eq!(c.transform(outp.to_vec()).unwrap(), inp);
}
}
#[test]
fn encodes_bytes_base32() {
check("base32", b"", b"");
check("base32", b"f", b"MY======");
check("base32", b"fo", b"MZXQ====");
check("base32", b"foo", b"MZXW6===");
check("base32", b"foob", b"MZXW6YQ=");
check("base32", b"fooba", b"MZXW6YTB");
check("base32", b"foobar", b"MZXW6YTBOI======");
check("base32,pad", b"", b"");
check("base32,pad", b"f", b"MY======");
check("base32,pad", b"fo", b"MZXQ====");
check("base32,pad", b"foo", b"MZXW6===");
check("base32,pad", b"foob", b"MZXW6YQ=");
check("base32,pad", b"fooba", b"MZXW6YTB");
check("base32,pad", b"foobar", b"MZXW6YTBOI======");
check("base32,nopad", b"", b"");
check("base32,nopad", b"f", b"MY");
check("base32,nopad", b"fo", b"MZXQ");
check("base32,nopad", b"foo", b"MZXW6");
check("base32,nopad", b"foob", b"MZXW6YQ");
check("base32,nopad", b"fooba", b"MZXW6YTB");
check("base32,nopad", b"foobar", b"MZXW6YTBOI");
}
#[test]
fn encodes_bytes_base32hex() {
check("base32hex", b"", b"");
check("base32hex", b"f", b"CO======");
check("base32hex", b"fo", b"CPNG====");
check("base32hex", b"foo", b"CPNMU===");
check("base32hex", b"foob", b"CPNMUOG=");
check("base32hex", b"fooba", b"CPNMUOJ1");
check("base32hex", b"foobar", b"CPNMUOJ1E8======");
check("base32hex,pad", b"", b"");
check("base32hex,pad", b"f", b"CO======");
check("base32hex,pad", b"fo", b"CPNG====");
check("base32hex,pad", b"foo", b"CPNMU===");
check("base32hex,pad", b"foob", b"CPNMUOG=");
check("base32hex,pad", b"fooba", b"CPNMUOJ1");
check("base32hex,pad", b"foobar", b"CPNMUOJ1E8======");
check("base32hex,nopad", b"", b"");
check("base32hex,nopad", b"f", b"CO");
check("base32hex,nopad", b"fo", b"CPNG");
check("base32hex,nopad", b"foo", b"CPNMU");
check("base32hex,nopad", b"foob", b"CPNMUOG");
check("base32hex,nopad", b"fooba", b"CPNMUOJ1");
check("base32hex,nopad", b"foobar", b"CPNMUOJ1E8");
}
#[test]
fn default_tests_base32() {
tests::round_trip("base32");
tests::basic_configuration("base32");
tests::invalid_data("base32");
}
#[test]
fn default_tests_base32hex() {
tests::round_trip("base32hex");
tests::basic_configuration("base32hex");
tests::invalid_data("base32hex");
}
#[test]
fn known_values() {
check("base32", tests::BYTE_SEQ, b"AAAQEAYEAUDAOCAJBIFQYDIOB4IBCEQTCQKRMFYYDENBWHA5DYPSAIJCEMSCKJRHFAUSUKZMFUXC6MBRGIZTINJWG44DSOR3HQ6T4P2AIFBEGRCFIZDUQSKKJNGE2TSPKBIVEU2UKVLFOWCZLJNVYXK6L5QGCYTDMRSWMZ3INFVGW3DNNZXXA4LSON2HK5TXPB4XU634PV7H7AEBQKBYJBMGQ6EITCULRSGY5D4QSGJJHFEVS2LZRGM2TOOJ3HU7UCQ2FI5EUWTKPKFJVKV2ZLNOV6YLDMVTWS23NN5YXG5LXPF5X274BQOCYPCMLRWHZDE4VS6MZXHM7UGR2LJ5JVOW27MNTWW33TO55X7A4HROHZHF43T6R2PK5PWO33XP6DY7F47U6X3PP6HZ7L57Z7P674======");
check("base32hex", tests::BYTE_SEQ, b"000G40O40K30E209185GO38E1S8124GJ2GAHC5OO34D1M70T3OFI08924CI2A9H750KIKAPC5KN2UC1H68PJ8D9M6SS3IEHR7GUJSFQ085146H258P3KGIAA9D64QJIFA18L4KQKALB5EM2PB9DLONAUBTG62OJ3CHIMCPR8D5L6MR3DDPNN0SBIEDQ7ATJNF1SNKURSFLV7V041GA1O91C6GU48J2KBHI6OT3SGI699754LIQBPH6CQJEE9R7KVK2GQ58T4KMJAFA59LALQPBDELUOB3CLJMIQRDDTON6TBNF5TNQVS1GE2OF2CBHM7P34SLIUCPN7CVK6HQB9T9LEMQVCDJMMRRJETTNV0S7HE7P75SRJUHQFATFMERRNFU3OV5SVKUNRFFU7PVBTVPVFUVS======");
}
}
| 40.462121 | 465 | 0.500094 |
95adb2d2f51a1dc35885596c3d8d9cc923806210
| 125 |
css
|
CSS
|
src/components/Nav/style.css
|
jkawahara/chuscanos
|
5132a6d3fabbb28faabbe3a36ca0a27cd3e2a9aa
|
[
"MIT"
] | null | null | null |
src/components/Nav/style.css
|
jkawahara/chuscanos
|
5132a6d3fabbb28faabbe3a36ca0a27cd3e2a9aa
|
[
"MIT"
] | null | null | null |
src/components/Nav/style.css
|
jkawahara/chuscanos
|
5132a6d3fabbb28faabbe3a36ca0a27cd3e2a9aa
|
[
"MIT"
] | null | null | null |
Nav {
text-align: right;
}
#navbar {
background-image: linear-gradient(120deg, steelblue 0%, skyblue 70%, white 100%);
}
| 17.857143 | 83 | 0.68 |
27def78ffd41d75430a0cc0566bfcbb299a871a0
| 1,791 |
kt
|
Kotlin
|
module_event/src/main/java/app/melon/event/NearbyEventsActivity.kt
|
biubiubiiu/Melon
|
6bb52f962084674ed50ffb3f8399c1b413a5a234
|
[
"Apache-2.0"
] | null | null | null |
module_event/src/main/java/app/melon/event/NearbyEventsActivity.kt
|
biubiubiiu/Melon
|
6bb52f962084674ed50ffb3f8399c1b413a5a234
|
[
"Apache-2.0"
] | null | null | null |
module_event/src/main/java/app/melon/event/NearbyEventsActivity.kt
|
biubiubiiu/Melon
|
6bb52f962084674ed50ffb3f8399c1b413a5a234
|
[
"Apache-2.0"
] | 1 |
2021-07-20T18:11:49.000Z
|
2021-07-20T18:11:49.000Z
|
package app.melon.event
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.activity.viewModels
import app.melon.event.databinding.ActivityNearbyEventsBinding
import app.melon.event.nearby.NearbyEventsViewModel
import app.melon.util.delegates.viewBinding
import dagger.android.support.DaggerAppCompatActivity
import javax.inject.Inject
class NearbyEventsActivity : DaggerAppCompatActivity() {
private val binding: ActivityNearbyEventsBinding by viewBinding()
@Inject internal lateinit var viewModelFactory: ViewModelFactory
private val viewModel by viewModels<NearbyEventsViewModel> { viewModelFactory }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setupToolbar()
}
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.menu_event_list, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
return when (item.itemId) {
android.R.id.home -> {
onBackPressed()
true
}
R.id.action_view_my_events -> {
MyEventsActivity.start(this)
true
}
else -> super.onOptionsItemSelected(item)
}
}
private fun setupToolbar() {
setSupportActionBar(binding.toolbar)
supportActionBar?.apply {
setDisplayHomeAsUpEnabled(true)
setDisplayShowHomeEnabled(true)
}
}
companion object {
internal fun start(context: Context) {
context.startActivity(Intent(context, NearbyEventsActivity::class.java))
}
}
}
| 29.85 | 84 | 0.686209 |
9c04c73e3743b4b7f88cdf3f1f3e05ebbf0ae062
| 330,457 |
js
|
JavaScript
|
drestpl2.js
|
dressroommbk/dressroommbk
|
59fc9476337c2a56049717bb6aa87cd71544dcf0
|
[
"MIT"
] | null | null | null |
drestpl2.js
|
dressroommbk/dressroommbk
|
59fc9476337c2a56049717bb6aa87cd71544dcf0
|
[
"MIT"
] | null | null | null |
drestpl2.js
|
dressroommbk/dressroommbk
|
59fc9476337c2a56049717bb6aa87cd71544dcf0
|
[
"MIT"
] | 1 |
2020-10-23T08:13:05.000Z
|
2020-10-23T08:13:05.000Z
|
var dresserScriptVersion = 199;
var saveSetOnServerUrl = '/dressroom/?action=save&saveset=1&texttosave={0}';
var absoluteDressRoomUrl = '/dressroom';
var battleScriptId = 'battleScriptId';
var battleProviderUrl = '/cgi/dresbatl.pl';
//var getCharacterInfoUrlFormat = '/cgi/get_ci.pl?nick={0}';
var getCharacterInfoUrlFormat = '/cgi/get_nick.pl?nick={0}';
var loadSetDialogParameters = "dialogHeight=326px";
var saveSetDialogParameters = "dialogHeight=316px";
var dressOptionsCookieName = 'dressOptions';
var serializableStateFormatVersion = 1;
var helpDivId = "helpDiv";
var infoDivId = "infoDiv";
var summaryDivId = "summaryDiv";
var expTableDivId = "expTableDiv";
var healerDivId = "healerDiv";
var battlesDivId = "battlesDiv";
var builderDivId = 'builderDiv';
var favStoreId = "favstore";
var historyStoreId = "historystore";
var offlineCookieId = "offlinecookie";
var menuImageIdPrefix = 'mnudrs_';
var hpMeterSuffix = '_HP';
var manaMeterSuffix = '_MP';
var minSharpLevels=[1,1,1,1,1,1,1,1,1,1,1,1];
var regSharpPrices = [0,20,40,80,160,320,640,1000,2000,3000,0,5000];
var dblSharpPrices = [0,40,80,160,320,640,1280,2000,4000,6000,0,10000];
var impRegSharpPrices = [0,0,0,0,0,0,10,20,50,65,0,200];
var impReqMagSharpPrices = [0,0,0,0,0,0,20,40,100,130,0,300];
var benderOmsk = {
saveLink: 'benderomsk://save?name={0}&value={1}',
loadLink: 'benderomsk://load?name={0}',
getInfoLink: 'benderomsk://getinf?login={0}'
};
var defaultImageFilter = 'revealtrans(duration = 0.5, transition = 23)';
var dressExData = {
exdata: 4,
fakes: {},
fakeDefs: {}
};
var dressOptions = {
showImages: true,
useAlphaForMenuAndTip: true,
useTransitionEffects: false,
preloadImages: false,
fminlevel: null,
fmaxlevel: null,
fshowold: false,
fshow_com: true,
fshow_ru: true,
fshow_artefacts: true,
ffiltermf: null,
frewardonly: false,
captureMouse: false,
embeddedMode: false,
hasGetCharInfo: false,
hasGetDSCharInfo: false,
showHealer: false,
showExp: true,
showBuilder: true,
helpWritten: false,
currentFilterTab: 0,
benderOmskMode: false,
colorizedDummy: true
};
var uiOptions = dressOptions;
var unusedStateId = 1;
var activeState = null;
var expTableBuilt = false;
var imagesToBeLoaded = {};
var preloadImagesDelay = 1000;
var someStatesLoaded = false;
var isBuffsVisible = true;
if (typeof (dressItems) == 'undefined')
{
dressItems = {};
}
if (typeof (dressStates) == 'undefined')
{
dressStates = {};
}
if (typeof (droppedDressStates) == 'undefined')
{
droppedDressStates = {};
}
if (typeof (dressSets) == 'undefined')
{
dressSets = {};
}
if (typeof (dressStrengthenings) == 'undefined')
{
dressStrengthenings = {};
}
if (typeof (categories) == 'undefined')
{
categories = {};
}
if (typeof (pets) == 'undefined')
{
pets = {};
}
if (typeof (tricks) == 'undefined')
{
tricks = {};
}
if (typeof (dressExchangePoints) == 'undefined')
{
dressExchangePoints = {};
}
function informAboutProgress(msg)
{
document.getElementById(infoDivId).innerHTML = msg;
}
var filterDialogProps = {};
var turnData = { strikes: {}, blockZones: 0 };
var menuhash = {};
var catselsources = {};
var catlistsources = {};
function showHelp()
{
var helpDiv = document.getElementById(helpDivId);
helpDiv.style.display = '';
if (!dressOptions.helpWritten)
{
document.getElementById('helpDivContent').innerHTML = helpChapterHtml;
dressOptions.helpWritten = true;
}
helpDiv.scrollIntoView();
}
function hideHelp()
{
var helpDiv = document.getElementById(helpDivId);
helpDiv.style.display = 'none';
window.scrollTo(0);
}
/* Common utilities */
function areArraysIntersect(A1, A2)
{
for (var i1 = 0; i1 < A1.length; i1++)
{
for (var i2 = 0; i2 < A2.length; i2++)
{
if (A1[i1] == A2[i2])
{
return true;
}
}
}
return false;
}
function cloneArray(a)
{
var r = a.concat([]);
return r;
}
function cloneObject(o)
{
var r = {};
for (var pname in o)
{
var v = o[pname];
if ((v != null) && ((typeof v) == 'object'))
{
if (v instanceof Array)
{
v = cloneArray(v);
}
else
{
v = cloneObject(v);
}
}
r[pname] = v;
}
return r;
}
function combineObjects(x, y)
{
var r = cloneObject(x);
for (var pname in y)
{
var v = y[pname];
if ((v != null) && ((typeof v) == 'object'))
{
if (v instanceof Array)
{
if (pname in r)
{
v = r[pname].concat(v);
}
else
{
v = cloneArray(v);
}
}
else
{
if (pname in r)
{
v = combineObjects(r[pname], v);
}
else
{
v = cloneObject(v);
}
}
}
r[pname] = v;
}
return r;
}
// Dresser specific code
function readOptionsCore(v)
{
if (v != null)
{
dressOptions.showImages = (v.length > 0) && (v.charAt(0) == 'Y');
dressOptions.useAlphaForMenuAndTip = (v.length > 1) && (v.charAt(1) == 'Y');
dressOptions.useTransitionEffects = (v.length > 2) && (v.charAt(2) == 'Y');
dressOptions.preloadImages = (v.length > 3) && (v.charAt(3) == 'Y');
dressOptions.fminlevel = (v.length > 4) && (v.charAt(4) != ' ') ? parseInt(v.charAt(4), 26) : null;
dressOptions.fmaxlevel = (v.length > 5) && (v.charAt(5) != ' ') ? parseInt(v.charAt(5), 26) : null;
dressOptions.fshowold = (v.length > 6) && (v.charAt(6) == 'Y');
dressOptions.captureMouse = (v.length <= 7) || (v.charAt(7) == 'Y');
if (v.length > 10 && v.charAt(8) != '_')
{
dressOptions.ffiltermf = parseInt(v.substr(8, 3), 16);
}
dressOptions.fshow_com = (v.length <= 11) || (v.charAt(11) == 'Y');
dressOptions.fshow_ru = (v.length <= 12) || (v.charAt(12) == 'Y');
dressOptions.fshow_artefacts = (v.length <= 13) || (v.charAt(13) == 'Y');
dressOptions.frewardonly = (v.length > 14) && (v.charAt(14) == 'Y');
dressOptions.colorizedDummy = (v.length <= 15) || (v.charAt(15) == 'Y');
if (dressOptions.preloadImages)
{
preloadImagesWanted();
}
// dressOptions.useAlphaForMenuAndTip &= is.ie;
dressOptions.useTransitionEffects &= is.ie;
dressOptions.captureMouse &= is.ie;
applyAlphaForMenuAndTipOption();
}
}
function onLoadBenderOmskVariable(name, value)
{
if (name == dressOptionsCookieName)
{
readOptionsCore(value);
return;
}
}
function readOptions()
{
var v = null;
if (dressOptions.benderOmskMode)
{
window.navigate(format(benderOmsk.loadLink, dressOptionsCookieName));
return;
}
if (isOfflineMode())
{
v = GetOfflineCookie(dressOptionsCookieName);
}
else
{
v = GetCookie(dressOptionsCookieName);
}
readOptionsCore(v);
}
function saveOptions()
{
var v = '';
v += dressOptions.showImages ? 'Y' : 'N';
v += dressOptions.useAlphaForMenuAndTip ? 'Y' : 'N';
v += dressOptions.useTransitionEffects ? 'Y' : 'N';
v += dressOptions.preloadImages ? 'Y' : 'N';
v += (dressOptions.fminlevel != null) ? dressOptions.fminlevel.toString(26) : ' ';
v += (dressOptions.fmaxlevel != null) ? dressOptions.fmaxlevel.toString(26) : ' ';
v += dressOptions.fshowold ? 'Y' : 'N';
v += dressOptions.captureMouse ? 'Y' : 'N';
if (dressOptions.ffiltermf != null)
{
var av = parseInt(dressOptions.ffiltermf).toString(16);
while (av.length < 3)
{
av = '0' + av;
}
v += av;
}
else
{
v += '___';
}
v += dressOptions.fshow_com ? 'Y' : 'N';
v += dressOptions.fshow_ru ? 'Y' : 'N';
v += dressOptions.fshow_artefacts ? 'Y' : 'N';
v += dressOptions.frewardonly ? 'Y' : 'N';
v += dressOptions.colorizedDummy ? 'Y' : 'N';
if (dressOptions.benderOmskMode)
{
window.navigate(format(benderOmsk.saveLink, dressOptionsCookieName, v));
}
else if (isOfflineMode())
{
SetOfflineCookie(dressOptionsCookieName, v, exp);
}
else
{
SetCookie(dressOptionsCookieName, v, exp);
}
}
function clearAllStats(state)
{
state.natural = {
level: 0,
levelup: 0,
pstat: 0,
pskil: 0,
strength: 3,
dexterity: 3,
intuition: 3,
endurance: 3,
intellect: 0,
wisdom: 0,
spirituality: 0
};
state.statElix = null;
state.damageElixes = {};
state.defElixes = {};
state.spellIntel = 0;
state.spellHitpoints = 0;
state.spellBD = 0;
state.spellPowerUps = {};
state.combatTricks = {};
state.pet = null;
}
function applyCleanItemsToState(state)
{
state.fitArmor = false;
state.w3sharp = 0;
state.w10sharp = 0;
state.objects = new Array(slots.length);
state.upgradeSlots = new Array(slots.length);
state.fitSlots = new Array(slots.length);
state.charmSlots = new Array(slots.length);
state.addSlots = new Array(slots.length);
state.runeSlots = new Array(slots.length);
state.objCache = new Array(slots.length);
state.trickSlots = new Array(21);
state.combatSpells = {};
state.statElix = null;
state.damageElixes = {};
state.defElixes = {};
state.spellIntel = 0;
state.spellHitpoints = 0;
state.spellBD = 0;
state.spellPowerUps = {};
state.combatTricks = {};
state.pet = null;
}
function createNewDresserState(stateid, persName, persImage, persSign)
{
if (stateid == null)
{
stateid = unusedStateId;
unusedStateId++;
}
var state = {
id: stateid,
name: persName || '',
align: '0',
clan: '',
sex: 0,
image: persImage || '0',
sign: persSign || '',
required: {},
appliedSets: [],
appliedStrengthenings: [],
powerUps: {},
modify: {},
results: {},
battlemf: {},
inbattle: {},
w3props: {},
w10props: {},
rendered: false
};
clearAllStats(state);
applyCleanItemsToState(state);
dressStates[state.id] = state;
return state;
}
function applyStyle(style, where, what, how)
{
if (where.indexOf(what) >= 0)
{
if (style.length > 0)
{
style += ', ';
}
style += how;
}
return style;
}
function getRealImagePath(objid, slot)
{
return ((objid == null) && ('emptyImageHere' in slot) && slot.emptyImageHere) ? hereItemImgPath : itemImgPath;
}
function getRealFilter(filter)
{
var style = defaultImageFilter;
if (dressOptions.colorizedDummy && filter != null && filter != '')
{
style = applyStyle(style, filter, 'redshadow', "shadow(color=red, direction=180, strength=3)");
style = applyStyle(style, filter, 'goldshadow', "shadow(color=gold, direction=90, strength=4)");
style = applyStyle(style, filter, 'purpleshadow', "shadow(color=purple, direction=270, strength=3)");
style = applyStyle(style, filter, 'blueshadow', "shadow(color=blue, direction=180, strength=3)");
style = applyStyle(style, filter, 'glow', 'glow(color=teal, strength=2)');
style = applyStyle(style, filter, 'glo2', 'glow(color=green, strength=2)');
style = applyStyle(style, filter, 'blur', 'blur');
style = applyStyle(style, filter, 'alpha', 'alpha(opacity = 70, style = 3)');
style = applyStyle(style, filter, 'wave', 'wave()');
}
return style;
}
function getImageId(state, slot, isMenu)
{
var imgId = state.id.toString();
if (isMenu)
{
imgId = menuImageIdPrefix + imgId;
}
imgId += slot.id;
return imgId;
}
function getObjectOverText(state, slot)
{
if (state == null || slot == null)
{
return '';
}
var html = '';
if (slot.id == 'w3' && state.w3sharp > 0)
{
html += '<img src="' + hereItemImgPath + 'sharpen_all_' + state.w3sharp + '.gif" width="40" height="25" border="0" />';
}
if (slot.id == 'w10' && state.w10sharp > 0)
{
html += '<img src="' + hereItemImgPath + 'sharpen_all_' + state.w10sharp + '.gif" width="40" height="25" border="0" />';
}
return html;
}
function getPersObjectImageHtml(state, slot, mode, showImages, xclick, runes)
{
var r = '';
var style = 'cursor: hand; filter:';
var onclick = '';
if (xclick != null)
{
onclick = xclick;
}
else if (mode == null)
{
onclick = format("onObjectClick('{0}', '{1}')", state.id, slot.id);
}
if (onclick != '')
{
onclick = format(' onclick="{0}" oncontextmenu="{0}"', onclick);
}
var objid = (mode == null) ? state.objects[slot.index] : mode;
var oimg = (objid == null) ? slot.id : objid;
var o = (mode == null) ? getObjectByStateSlot(state, slot) : getObjectById(oimg);
var sizeX = (runes == 1) ? o.width : slot.width;
var sizeY = (runes == 1) ? o.height : slot.height;
var filter = (mode == null) ? getObjectFilter(state, slot, o) : '';
var imgId = getImageId(state, slot, (mode != null));
var imgFormat = (o != null && 'imgFormat' in o) ? o.imgFormat : defaultImgFormat;
style += getRealFilter(filter);
if (xclick == null) r += '<td valign="top">';
if (showImages == null || showImages)
{
var realItemImgPath = getRealImagePath(objid, slot);
/*
if (mode == null)
{
r += format('<div style="position: relative; z-index: 0; left: {0}px; top: 0px; wrap: off">', slot.width - 40);
r += getObjectOverText(state, slot);
r += '</div>';
}
*/
r += format(
'<img id="{5}" name="x{1}" src="{0}{1}.{7}" width="{2}" height="{3}" style="{4}" border="0"{6} onmouseover="showItemProps(this)" onmouseout="hidePopup()" />',
realItemImgPath,
oimg,
sizeX,
sizeY,
style,
imgId,
onclick,
imgFormat
);
}
else
{
r += format(
'<span id="{1}" name="x{4}" style="{0}" border="0"{2} onmouseover="showItemProps(this)" onmouseout="hidePopup()">{3}</span>',
style,
imgId,
onclick,
o.caption,
oimg
);
}
if (xclick == null) r += '</td>';
return r;
}
function isImgInSlot(imgElt)
{
var id = imgElt.id;
var yes = (id.indexOf(menuImageIdPrefix) !== 0);
return yes;
}
function getImgEltState(imgElt)
{
return activeState;
}
function getImgEltSlot(imgElt)
{
var id = imgElt.id;
if (id.indexOf(menuImageIdPrefix) === 0)
{
id = id.substr(menuImageIdPrefix.length, id.length - menuImageIdPrefix.length)
}
id = id.substr(activeState.id.toString().length);
return getSlotById(id);
}
function setMeter(state, meterSuffix, value)
{
var baseId = format('{1}{0}', state.id, meterSuffix);
if (document.getElementById(baseId) == null)
{
return;
}
if (value == null)
{
value = 0;
}
var s = value.toString();
s = s + '/' + s;
var w = 240 - ((s.length + 2) * 7);
var displayMode = (value > 0) ? '' : 'none';
document.getElementById(baseId).style.display = displayMode;
document.getElementById(baseId + 'v').innerHTML = s;
document.getElementById(baseId + 'i').width = w;
}
function getPersNickString(state)
{
if (state.name == '')
{
return '';
}
var clanimg = '';
if (state.clan != '')
{
clanimg = format('<img src="{1}{0}.gif" width="24" height="15" border="0" alt="{0}" />', state.clan, clanImgPath);
}
return format('<nobr><img src="{4}align{3}.gif" width="12" height="15" border="0" />{5}<b>{0}</b> [{2}]<a target="_blank" href="{6}{1}"><img src="{4}inf.gif" width="12" height="11" border="0" /></a></nobr>', htmlstring(state.name), state.name, state.natural.level, state.align, baseImgPath, clanimg, charInfoUrlFormat);
}
function showPetProps(e)
{
var state = activeState;
if (state == null || state.pet == null)
{
return;
}
var pet = pets[state.pet.n];
var pl = pet.levels['L' + state.pet.level];
var html = '<b>' + pet.caption2 + ' [' + pl.level + ']</b><br />';
html += 'Имя: ' + state.pet.name + '<br />';
if ('skill' in pl)
{
html += '<b>Освоенные навыки</b><br />';
html += pl.skill.caption + ' [' + pl.skill.level + ']';
}
showPopup(html);
if (!is.ie && e.stopPropagation)
{
e.stopPropagation();
}
if (is.ie)
{
window.event.cancelBubble = true;
window.event.returnValue = false;
}
return false;
}
function ShowBuffs(e, btn) {
var buffs = document.getElementById('buffs_icons'),
btn_image = document.getElementById('buffs_effect');
isBuffsVisible = !isBuffsVisible;
if (isBuffsVisible) {
buffs.className = 'visible';
btn.title = 'Скрыть обкаст';
btn_image.src = baseImgPath + 'effs_hide.gif';
} else {
buffs.className = 'hidden';
btn.title = 'Показать обкаст';
btn_image.src = baseImgPath + 'effs_show.gif';
}
if (!is.ie && e.stopPropagation) {
e.stopPropagation();
}
if (is.ie) {
window.event.cancelBubble = true;
window.event.returnValue = false;
}
return false;
}
function showCharPopup()
{
showPopup(localizer.charHint);
}
function getLegend(type, key, values) {
let legend = 'No legend for this object',
obj = undefined;
switch (type) {
case 'ecr':
obj = knownECRPowerUps[key];
break;
case 'powerup':
obj = knownPowerUps[key];
break;
case 'damageelix':
obj = knownDamageElix[key];
break;
case 'wadd':
obj = knownAdds[key];
break;
case 'defelix':
obj = knownDefElix[key];
break;
case 'selix':
obj = knownElix[key];
break;
case 'applicable':
obj = knownApplicableSpells[key];
break;
default:
}
if (obj !== undefined && 'legend' in obj && obj.legend.length > 0) {
legend = obj.legend;
if (values instanceof Array) {
for (let i = 0; i < values.length; i++) {
legend = legend.split('{' + i + '}').join(values[i]);
}
}
}
return legend;
}
function getPersImageHtml(state)
{
var oimg;
var i;
var hp = ('hitpoints' in state.results) ? state.results.hitpoints : 0;
hp = hp.toString();
hp = hp + '/' + hp;
var r = '';
r += '<table border="0" cellspacing="0" cellpadding="0"';
if (state.sign != '')
{
r += ' style="background-image: url(';
r += zodiacImgPath + state.sign;
r += '.gif); background-repeat: no-repeat; background-position: top right;"';
}
r += '>';
r += format('<tr><td id="{1}{0}" align="center" style="font-size: 12px;">{2}</td></tr>', state.id, 'nick', getPersNickString(state));
r += format('<tr><td id="{1}{0}" width="240" align="left" nowrap="yes" style="font-size: 10px;">', state.id, hpMeterSuffix);
r += format('<span id="{1}{0}v">{2}</span> ', state.id, hpMeterSuffix, hp);
var w = 240 - ((hp.length + 2) * 7);
r += format('<img id="{4}{3}i" src="{0}" width="{2}" height="8" alt="{1} (100%)" border="0" />', hpMeterGreenImg, getItemPropLabel('hitpoints'), w, state.id, hpMeterSuffix);
r += format('<img src="{0}herz.gif" width="10" height="9" alt="{1}"/>', baseImgPath, getItemPropLabel('hitpoints'));
var mana = ('mana' in state.results) ? state.results.mana : 0;
var manaDisplayMode = (mana > 0) ? '' : 'none';
mana = mana.toString();
mana = mana + '/' + mana;
r += format('</td></tr><tr><td id="{1}{0}" width="240" align="left" nowrap="yes" style="font-size: 10px; display: {2}">', state.id, manaMeterSuffix, manaDisplayMode);
r += format('<span id="{1}{0}v">{2}</span> ', state.id, manaMeterSuffix, mana);
w = 240 - ((mana.length + 2) * 7);
r += format('<img id="{4}{3}i" src="{0}" width="{2}" height="8" alt="{1} (100%)" border="0" />', manaMeterImg, getItemPropLabel('mana'), w, state.id, manaMeterSuffix);
r += format('<img src="{0}Mherz.gif" width="10" height="9" alt="{1}"/>', baseImgPath, getItemPropLabel('mana'));
r += '</td></tr><tr height="4"><td height="4"></td></tr><tr><td><table border="0" cellspacing="0" cellpadding="0"><tr>';
// w100 - w109
for (i = 100; i < 105; i++)
{
r += getPersObjectImageHtml(state, getSlotById('w' + i));
}
// this slot is handled as book slot.
r += getPersObjectImageHtml(state, slot_wbook);
// r += format('<td><img style="filter:alpha(opacity = 40, style = 3)" src="{0}w{1}.gif" width="40" height="25" border="0" /></td>', itemImgPath, 109);
r += '</tr><tr>';
for (i = 105; i < 110; i++)
{
r += getPersObjectImageHtml(state, getSlotById('w' + i));
}
// this slot is handled separately like as BK.
r += format('<td><img style="opacity: 0.4; MozOpacity: 0.4; KhtmlOpacity: 0.4; filter:alpha(opacity = 40, style = 3)" src="{0}w{1}.gif" width="40" height="25" border="0" /></td>', itemImgPath, 109);
r += '</tr></table></td></tr><tr><td><table border="0" cellspacing="0" cellpadding="0"><tr><td width="60"><table width="60" border="0" cellpadding="0" cellspacing="0"><tr>';
// w9
r += getPersObjectImageHtml(state, slot_w9);
r += '</tr><tr>';
// w13
r += getPersObjectImageHtml(state, slot_w13);
r += '</tr><tr>';
// w3
r += getPersObjectImageHtml(state, slot_w3);
r += '</tr><tr>';
// w4
r += getPersObjectImageHtml(state, slot_w4);
r += '</tr><tr>';
// w5
r += getPersObjectImageHtml(state, slot_w5);
r += '</tr></table></td>';
r += '<td width="120"><table width="120" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="3" width="120" onclick="onPersMenu();" height="220" align="left" valign="bottom" style="background-image:url(';
r += charImgPath + state.sex + '/' + state.image;
r += '.gif); background-repeat: no-repeat; background-position: center center;">';
r += '<div class="persimage_container">';
r += '<div class="persimage_layer buffs">';
r += '<a href="javascript:;" title="' + (isBuffsVisible ? 'Скрыть обкаст' : 'Показать обкаст') + '" onclick="ShowBuffs(event, this);"><img id="buffs_effect" src="' + baseImgPath + (isBuffsVisible ? 'effs_hide.gif' : 'effs_show.gif') +'" /></a>';
r += '<div id="buffs_icons" class="' + (isBuffsVisible ? 'visible' : 'hidden') + '">'
var o = getObjectByStateSlot(state, slot_wadd);
if (o != null) {
r += '<a onclick="onApplyWAdd(event, null);" href="javascript:;" onmouseover="showPopup(getLegend(\'wadd\', \'' + o.id + '\', null));" onmouseout="hidePopup();">';
r += '<img src="' + iconImgPath + o.id + '.gif" width="36" height="23" border="0" />';
r += '</a>';
}
for (let powerUpn in state.spellPowerUps) {
if (powerUpn in knownECRPowerUps) {
let powerUp = knownECRPowerUps[powerUpn];
r += '<a onclick="onECRPowerUp(event, ' + "'" + powerUpn + "'" + ')" href="javascript:;" onmouseover="showPopup(getLegend(\'ecr\', \'' + powerUpn + '\', null));" onmouseout="hidePopup();">';
r += '<img src="' + iconImgPath + powerUp.id + '.gif" width="36" height="23" border="0" />';
r += '</a>';
}
if (powerUpn in knownPowerUps) {
let powerUp = knownPowerUps[powerUpn];
r += '<a onclick="onPowerUp(event, ' + "'" + powerUpn + "'" + ')" href="javascript:;" onmouseover="showPopup(getLegend(\'powerup\', \'' + powerUpn + '\', null));" onmouseout="hidePopup();">';
r += '<img src="' + iconImgPath + powerUp.id + '.gif" width="36" height="23" border="0" />';
r += '</a>';
}
}
if (state.statElix != null)
{
var selix = knownElix[state.statElix.elixn];
r += '<a onclick="onConcreteElixMenu(event, ' + "'" + state.statElix.elixn + "'" + ')" href="javascript:;" onmouseover="showPopup(getLegend(\'selix\', \'' + state.statElix.elixn + '\', [' + state.statElix.v +']));" onmouseout="hidePopup();">';
r += '<img src="' + iconImgPath + selix.id + '.gif" width="36" height="23" border="0" />';
r += '</a>';
}
for (var damageelixn in state.damageElixes)
{
var damageelix = knownDamageElix[damageelixn];
r += '<a onclick="onApplyConcreteElix(event, ' + "'" + damageelixn + "'" + ', 0)" href="javascript:;" onmouseover="showPopup(getLegend(\'damageelix\', \'' + damageelixn + '\', null));" onmouseout="hidePopup();">';
r += '<img src="' + iconImgPath + damageelix.id + '.gif" width="36" height="23" border="0" />';
r += '</a>';
}
for (var defelixn in state.defElixes)
{
var defelix = knownDefElix[defelixn];
r += '<a onclick="onConcreteElixMenu(event, ' + "'" + defelix.id + "'" + ')" href="javascript:;" onmouseover="showPopup(getLegend(\'defelix\', \'' + defelixn + '\', [' + state.defElixes[defelixn] + ']));" onmouseout="hidePopup();">';
r += '<img src="' + iconImgPath + defelix.id + '.gif" width="36" height="23" border="0" />';
r += '</a>';
}
if (state.spellHitpoints != 0)
{
var spellHitpointsId = 'spellHitpointsUp';
var spellHitpointsName = knownApplicableSpells.spellHitpointsUp.id;
var spellHitpointsCaption = knownApplicableSpells.spellHitpointsUp.caption;
if (state.spellHitpoints < 0)
{
var spellHitpointsId = 'spellHitpointsDown';
spellHitpointsName = knownApplicableSpells.spellHitpointsDown.id;
spellHitpointsCaption = knownApplicableSpells.spellHitpointsDown.caption;
}
r += '<a onclick="onConcreteElixMenu(event, ' + "'" + spellHitpointsId + "'" + ')" href="javascript:;" onmouseover="showPopup(getLegend(\'applicable\', \'spellHitpointsUp\', [' + state.spellHitpoints +', ' + state.spellHitpoints * (state.natural.endurance + state.modify.endurance) + ']));" onmouseout="hidePopup();">';
r += '<img src="' + itemImgPath + format(spellHitpointsName, Math.abs(state.spellHitpoints)) + '.gif" width="36" height="23" border="0" />';
r += '</a>';
}
if (state.spellIntel > 0)
{
r += '<a onclick="onConcreteElixMenu(event, ' + "'spellIntel'" + ')" href="javascript:;" onmouseover="showPopup(getLegend(\'applicable\', \'spellIntel\', null));" onmouseout="hidePopup();">';
r += '<img src="' + itemImgPath + 'icon_' + knownApplicableSpells.spellIntel.id + '.gif" width="36" height="23" border="0" />';
r += '</a>';
}
if (state.spellBD > 0)
{
r += '<a onclick="onConcreteElixMenu(event, ' + "'spellBD'" + ')" href="javascript:;" onmouseover="showPopup(getLegend(\'applicable\', \'spellBD\', [' + state.spellBD + ',' + 6 * state.spellBD + ',' + 10 * state.spellBD + ']));" onmouseout="hidePopup();">';
r += '<img src="' + trickImgPath + knownApplicableSpells.spellBD.id + '.gif" width="36" height="23" border="0" />';
r += '</a>';
}
r += '</div></div><div class="persimage_layer pet">';
if (state.pet != null)
{
var pet = pets[state.pet.n];
r += format('<img src="{0}{2}/{1}.gif" alt="" title="" onmouseover="showPetProps(event)" onclick="event.stopPropagation();" onmouseout="hidePopup()" width="40" height="73" border="0" />', charImgPath, pet.image.def, pet.image.sex);
}
r += '</div></div>';
r += '</td></tr><tr>';
r += getPersObjectImageHtml(state, slot_w14);
// w16 is skipped
r += format('<td height="20"><img style="opacity: 0.4; MozOpacity: 0.4; KhtmlOpacity: 0.4; filter:alpha(opacity = 40, style = 3)" src="{0}w14.gif" width="40" height="20" border="0" /></td>', itemImgPath);
r += getPersObjectImageHtml(state, slot_w15);
r += '</tr><tr>';
r += format('<td height="20"><img style="opacity: 0.4; MozOpacity: 0.4; KhtmlOpacity: 0.4; filter:alpha(opacity = 40, style = 3)" src="{0}w20_1.gif" width="40" height="20" border="0" /></td>', itemImgPath);
r += format('<td height="20"><img style="opacity: 0.4; MozOpacity: 0.4; KhtmlOpacity: 0.4; filter:alpha(opacity = 40, style = 3)" src="{0}w20_1.gif" width="40" height="20" border="0" /></td>', itemImgPath);
r += format('<td height="20"><img style="opacity: 0.4; MozOpacity: 0.4; KhtmlOpacity: 0.4; filter:alpha(opacity = 40, style = 3)" src="{0}w20_1.gif" width="40" height="20" border="0" /></td>', itemImgPath);
r += '</tr></table></td><td width="60"><table width="60" border="0" cellpadding="0" cellspacing="0"><tr>';
// w1
r += getPersObjectImageHtml(state, slot_w1);
r += '</tr><tr>';
// w2
r += getPersObjectImageHtml(state, slot_w2);
r += '</tr><tr><td><table border="0" cellspacing="0" cellpadding="0"><tr>';
// w6
r += getPersObjectImageHtml(state, slot_w6);
// w7
r += getPersObjectImageHtml(state, slot_w7);
// w8
r += getPersObjectImageHtml(state, slot_w8);
r += '</tr></table></td></tr><tr>';
// w11
r += getPersObjectImageHtml(state, slot_w11);
r += '</tr><tr>';
// w10
r += getPersObjectImageHtml(state, slot_w10);
r += '</tr><tr>';
// w19
r += getPersObjectImageHtml(state, slot_w19);
r += '</tr><tr>';
// w12
r += getPersObjectImageHtml(state, slot_w12);
r += '</tr></table></td>';
r += '<td width="60" valign="bottom"><table width="60" border="0" cellpadding="0" cellspacing="0"><tr>';
// w18
r += getPersObjectImageHtml(state, slot_w18);
r += '</tr><tr>';
// wshirt (w0)
r += getPersObjectImageHtml(state, slot_w0);
r += '</tr><tr>';
// w17
r += getPersObjectImageHtml(state, slot_w17);
r += '</tr></tr></table></td></tr></table></td></tr><tr><td style="padding:5px 5px 0 0;"><table border="0" cellspacing="0" cellpadding="0">';
for (var ci = 0; ci < 3; ci++)
{
r += '<tr>';
for (var i = 0; i < 8; i++)
{
if (ci==2 && i >= 7) { continue; }
var trickNumber = (ci * 8) + i;
r += getSingleTrickSlotHtml(state, trickNumber, state.trickSlots[trickNumber]);
}
r += '</tr>';
}
r += '</table></td></tr></table>';
return r;
}
function changePersName()
{
var state = activeState;
if (state == null)
{
return;
}
var name = window.prompt('Введите имя этого персонажа', state.name);
if (name == null)
{
return;
}
state.name = name.toString();
hardUpdateDresserState(state);
}
function changePersAlignTo(align)
{
var state = activeState;
if (state == null)
{
return;
}
state.align = align;
hardUpdateDresserState(state);
}
function changePersAlign()
{
var state = activeState;
if (state == null)
{
return;
}
var menuHtml = '<b>' + localizer.alignments + '</b>';
menuHtml += '<table cellspacing="0" cellpadding="0" border="0"><tr><td>';
menuHtml += '<table cellspacing="0" cellpadding="0" border="0"><tr>';
var groupCount = 0;
for (var ai = 0; ai < aligns.length; ai++)
{
var a = aligns[ai];
if ('id' in a)
{
menuHtml += getRowMenuItemHtml('<img width="12" height="15" border="0" src="' + baseImgPath + 'align' + a.id + '.gif" /> ' + a.caption, 'changePersAlignTo(' + "'" + a.id + "'" + ')');
}
else
{
if (groupCount > 0)
{
menuHtml += '</table></td>';
}
menuHtml += '<td valign="top">';
menuHtml += '<table cellspacing="0" cellpadding="0" border="0">';
menuHtml += '<tr><td align="center"><small><b>';
menuHtml += a.caption;
menuHtml += '</b></small></td></tr>';
groupCount++;
}
}
menuHtml += '</table></td></tr>';
menuHtml += '</table></td></tr>';
menuHtml += '<tr><td>';
menuHtml += '<hr class="dashed" />';
menuHtml += '</td></tr>';
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
cursorX -= 40;
cursorY -= 100;
showMenu(menuHtml);
}
function changePersClan()
{
var state = activeState;
if (state == null)
{
return;
}
var clan = window.prompt('Введите название клана', state.clan);
if (clan == null)
{
return;
}
state.clan = clan.toString();
hardUpdateDresserState(state);
}
function changePersGender()
{
var state = activeState;
if (state == null)
{
return;
}
// test nonstandard image
if (isNaN(state.image))
{
state.image = '0';
}
state.sex = 1 - state.sex;
// test unexistent sex image
if (maxPersImageNumber[state.sex] < parseInt(state.image))
{
state.image = '0';
}
for (var i = 0; i < excludePersImageNumbers[state.sex].length; i++)
{
if (excludePersImageNumbers[state.sex][i] == parseInt(state.image))
{
state.image = '0';
break;
}
}
hardUpdateDresserState(state);
}
function changePersImageTo(imagestr)
{
var state = activeState;
if (state == null)
{
return;
}
state.image = imagestr.toString();
hardUpdateDresserState(state);
}
function changePersImage()
{
var state = activeState;
if (state == null)
{
return;
}
var cpin = 'cpimag_' + state.sex;
if (cpin in menuhash)
{
showMenu(menuhash[cpin]);
return;
}
// test nonstandard image
if (isNaN(state.image))
{
state.image = '0';
}
var perRow = ((8 * 60) / 60);
var menuHtml = '<b>' + localizer.appearances + '</b>';
menuHtml += '<table cellspacing="0" cellpadding="0" border="0"><tr><td>';
menuHtml += '<table cellspacing="0" cellpadding="0" border="0"><tr>';
var ri = 0;
for (var i = 0; i <= maxPersImageNumber[state.sex]; i++)
{
var needCont = false;
for (var ei = 0; ei < excludePersImageNumbers[state.sex].length; ei++)
{
if (excludePersImageNumbers[state.sex][ei] == i)
{
needCont = true;
break;
}
}
if (needCont)
{
continue;
}
var onclick = format("hideMenu(); changePersImageTo('{0}')", i);
menuHtml += getCellMenuItemHtml(format('<img src="{0}{1}/{2}.gif" width="60" height="110" border="0" />',
charImgPath,
state.sex,
i),
onclick);
if ((ri % perRow) == (perRow - 1))
{
menuHtml += '</tr><tr>';
}
ri += 1;
}
for (var i = 0; i < uniquePersImageNumbers[state.sex].length; i++)
{
var code = uniquePersImageNumbers[state.sex][i];
var onclick = format("hideMenu(); changePersImageTo('{0}')", code);
menuHtml += getCellMenuItemHtml(format('<img src="{0}{1}/{2}.gif" width="60" height="110" border="0" />',
charImgPath,
state.sex,
code),
onclick);
if ((ri % perRow) == (perRow - 1))
{
menuHtml += '</tr><tr>';
}
ri += 1;
}
menuHtml += '</tr></table>';
menuHtml += '</td></tr><tr><td>';
menuHtml += '<hr class="dashed" />';
menuHtml += '</td></tr>';
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
menuhash[cpin] = menuHtml;
showMenu(menuHtml);
}
function changePersSignTo(sign)
{
var state = activeState;
if (state == null)
{
return;
}
state.sign = sign;
hardUpdateDresserState(state);
}
function changePersSign()
{
var menuHtml ='<table width="180px" border="0">';
for (var i = 1; i <= 12; i++)
{
menuHtml += getRowMenuItemHtml(localizer['zodiac' + i], 'changePersSignTo(' + i + ')');
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.zodiac0, "changePersSignTo('')");
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
showMenu(menuHtml);
if (is.ie)
{
window.event.returnValue = false;
}
return false;
}
function onPersMenu()
{
var menuHtml ='<table width="180px" border="0">';
menuHtml += getRowMenuItemHtml(localizer.changeName, 'changePersName()');
menuHtml += getRowMenuItemHtml(localizer.changeGender, 'changePersGender()');
menuHtml += getRowMenuItemHtml(localizer.changeSign, 'changePersSign()');
menuHtml += getRowMenuItemHtml(localizer.changeImage, 'changePersImage()');
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.changeAlign, 'changePersAlign()');
// menuHtml += getRowMenuItemHtml(localizer.changeClan, 'changePersClan()');
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
showMenu(menuHtml);
if (is.ie)
{
window.event.returnValue = false;
}
return false;
}
function onSharpeningMenu(slotid, minlevel, allownew, isstf, isdbl)
{
var state = activeState;
var slot = getSlotById(slotid);
if (state == null || slot == null)
{
return;
}
var o = getObjectByStateSlot(state, slot);
var actionTitle = localizer.sharpening, noActionTitle = localizer.noSharpening;
if('category' in o && o.category === 'staffs') {
actionTitle = localizer.staffSpelling;
noActionTitle = localizer.noStaffSpelling;
}
//var menuHtml ='<table width="360px" border="0"><tr><td valign="middle" align="center"><table width="180px" border="0">';
var menuHtml ='<table width="180px" border="0"><tr><td valign="middle" align="center"><table width="100%" border="0">';
menuHtml += getRowMenuItemHtml(noActionTitle, format("onSharpWeapon('{0}', '{1}', 0)", state.id, slot.id));
/*if (allownew == 1)
{
menuHtml += getRowMenuSeparatorHtml();
if (isstf != 1) { menuHtml += getRowMenuItemHtml(format('{0} +1', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 101)", state.id, slot.id)); }
if (isstf != 1) { menuHtml += getRowMenuItemHtml(format('{0} +2', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 102)", state.id, slot.id)); }
if (isstf != 1) { menuHtml += getRowMenuItemHtml(format('{0} +3', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 103)", state.id, slot.id)); }
if ((isstf != 1) && (minlevel >= 1) && (isdbl == 1)) { menuHtml += getRowMenuItemHtml(format('{0} +4', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 104)", state.id, slot.id)); }
if (minlevel >=2) { menuHtml += getRowMenuItemHtml(format('{0} +5', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 105)", state.id, slot.id)); }
if (minlevel >=3) { menuHtml += getRowMenuItemHtml(format('{0} +6', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 106)", state.id, slot.id)); }
if (minlevel >=4) { menuHtml += getRowMenuItemHtml(format('{0} +7', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 107)", state.id, slot.id)); }
if (minlevel >=5) { menuHtml += getRowMenuItemHtml(format('{0} +8', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 108)", state.id, slot.id)); }
if (minlevel >=6) { menuHtml += getRowMenuItemHtml(format('{0} +9', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 109)", state.id, slot.id)); }
if (minlevel >=8) { menuHtml += getRowMenuItemHtml(format('{0} +11', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 111)", state.id, slot.id)); }
}
menuHtml += '</table></td><td valign="middle" align="center"><table width="180px" border="0">';
menuHtml += getRowMenuItemHtml(format('{0} +1 [old]', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 1)", state.id, slot.id));
menuHtml += getRowMenuItemHtml(format('{0} +2 [old]', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 2)", state.id, slot.id));
menuHtml += getRowMenuItemHtml(format('{0} +3 [old]', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 3)", state.id, slot.id));
menuHtml += getRowMenuItemHtml(format('{0} +4 [old]', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 4)", state.id, slot.id));
menuHtml += getRowMenuItemHtml(format('{0} +5 [old]', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 5)", state.id, slot.id));
menuHtml += getRowMenuItemHtml(format('{0} +7 [old]', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 7)", state.id, slot.id));
menuHtml += getRowMenuItemHtml(format('{0} +10 [old]', localizer.sharpening), format("onSharpWeapon('{0}', '{1}', 10)", state.id, slot.id));
menuHtml += '</table></td></tr><tr><td colspan="2" align="middle"><table align="center" width="360" border="0">';
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');*/
menuHtml += getRowMenuSeparatorHtml();
if (checkSharpeningAllowed(o.category, ('imp1' in o && o.imp1 === true) || ('artefact' in o && o.artefact === true), isTwohandledWeapon(o), 1)) { menuHtml += getRowMenuItemHtml(format('{0} +1', actionTitle), format("onSharpWeapon('{0}', '{1}', 101)", state.id, slot.id)); }
if (checkSharpeningAllowed(o.category, ('imp1' in o && o.imp1 === true) || ('artefact' in o && o.artefact === true), isTwohandledWeapon(o), 2)) { menuHtml += getRowMenuItemHtml(format('{0} +2', actionTitle), format("onSharpWeapon('{0}', '{1}', 102)", state.id, slot.id)); }
if (checkSharpeningAllowed(o.category, ('imp1' in o && o.imp1 === true) || ('artefact' in o && o.artefact === true), isTwohandledWeapon(o), 3)) { menuHtml += getRowMenuItemHtml(format('{0} +3', actionTitle), format("onSharpWeapon('{0}', '{1}', 103)", state.id, slot.id)); }
if (checkSharpeningAllowed(o.category, ('imp1' in o && o.imp1 === true) || ('artefact' in o && o.artefact === true), isTwohandledWeapon(o), 4)) { menuHtml += getRowMenuItemHtml(format('{0} +4', actionTitle), format("onSharpWeapon('{0}', '{1}', 104)", state.id, slot.id)); }
if (checkSharpeningAllowed(o.category, ('imp1' in o && o.imp1 === true) || ('artefact' in o && o.artefact === true), isTwohandledWeapon(o), 5)) { menuHtml += getRowMenuItemHtml(format('{0} +5', actionTitle), format("onSharpWeapon('{0}', '{1}', 105)", state.id, slot.id)); }
if (checkSharpeningAllowed(o.category, ('imp1' in o && o.imp1 === true) || ('artefact' in o && o.artefact === true), isTwohandledWeapon(o), 6)) { menuHtml += getRowMenuItemHtml(format('{0} +6', actionTitle), format("onSharpWeapon('{0}', '{1}', 106)", state.id, slot.id)); }
if (checkSharpeningAllowed(o.category, ('imp1' in o && o.imp1 === true) || ('artefact' in o && o.artefact === true), isTwohandledWeapon(o), 7)) { menuHtml += getRowMenuItemHtml(format('{0} +7', actionTitle), format("onSharpWeapon('{0}', '{1}', 107)", state.id, slot.id)); }
if (checkSharpeningAllowed(o.category, ('imp1' in o && o.imp1 === true) || ('artefact' in o && o.artefact === true), isTwohandledWeapon(o), 8)) { menuHtml += getRowMenuItemHtml(format('{0} +8', actionTitle), format("onSharpWeapon('{0}', '{1}', 108)", state.id, slot.id)); }
if (checkSharpeningAllowed(o.category, ('imp1' in o && o.imp1 === true) || ('artefact' in o && o.artefact === true), isTwohandledWeapon(o), 9)) { menuHtml += getRowMenuItemHtml(format('{0} +9', actionTitle), format("onSharpWeapon('{0}', '{1}', 109)", state.id, slot.id)); }
if (checkSharpeningAllowed(o.category, ('imp1' in o && o.imp1 === true) || ('artefact' in o && o.artefact === true), isTwohandledWeapon(o), 11)) { menuHtml += getRowMenuItemHtml(format('{0} +11', actionTitle), format("onSharpWeapon('{0}', '{1}', 111)", state.id, slot.id)); }
menuHtml += '</table></td></tr></table>';
cursorY -= 200;
showMenu(menuHtml);
if (is.ie)
{
window.event.returnValue = false;
}
return false;
}
function areSameObjectsWeared(state, slot1, slot2)
{
if (state == null) return false;
if (slot1 == slot2) return true;
if (slot1 == slot_w3 || slot1 == slot_w10)
{
if ((slot2 != slot_w3 && slot2 != slot_w10) || (state.w3sharp != state.w10sharp))
{
return false;
}
}
var oid1 = state.objects[slot1.index];
var oid2 = state.objects[slot2.index];
if (oid1 == null || oid2 == null) return false;
return true
&& (oid1 == oid2)
&& (state.upgradeSlots[slot1.index] == state.upgradeSlots[slot2.index])
&& (state.fitSlots[slot1.index] == state.fitSlots[slot2.index])
&& (state.charmSlots[slot1.index] == state.charmSlots[slot2.index])
&& (state.addSlots[slot1.index] == state.addSlots[slot2.index])
&& (state.runeSlots[slot1.index] == state.runeSlots[slot2.index])
;
}
function openObjectData(slotid)
{
var state = activeState;
var slot = getSlotById(slotid);
var o = getObjectByStateSlot(state, slot);
var html = '';
html += '<div style="width: 100%">';
html += getDresserInfoPaneTabsHtml(-1);
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab-content"><tr><td colspan="2">';
html += '<table width="100%" border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
html += '<tr><td>';
html += getObjectDescHtml(state, o);
html += '</td></tr>';
html += '</table>';
html += '</td></tr>';
html += '</table>';
html += '</td></tr></table>';
html += '</div>';
document.getElementById('infopane' + state.id).innerHTML = html;
}
function onObjectClick(stateid, slotid)
{
var i;
var state = dressStates[stateid];
var slot = getSlotById(slotid);
if (state == null || slot == null)
{
return;
}
var origin = getObjectById(state.objects[slot.index]);
var o = getObjectByStateSlot(state, slot);
var menuHtml ='<table width="180px" border="0">';
if (slot.id == 'w6')
{
var ow7 = getObjectByStateSlot(state, slot_w7);
if (ow7 != null)
{
menuHtml += getRowMenuItemHtml(localizer.dressSameItem + ' ' + ow7.caption, format("onItemWearFrom('{0}', '{1}')", slotid, slot_w7.id));
}
var ow8 = getObjectByStateSlot(state, slot_w8);
if (ow8 != ow7 && ow8 != null)
{
menuHtml += getRowMenuItemHtml(localizer.dressSameItem + ' ' + ow8.caption, format("onItemWearFrom('{0}', '{1}')", slotid, slot_w8.id));
}
}
if (slot.id == 'w7')
{
var ow6 = getObjectByStateSlot(state, slot_w6);
if (ow6 != null)
{
menuHtml += getRowMenuItemHtml(localizer.dressSameItem + ' ' + ow6.caption, format("onItemWearFrom('{0}', '{1}')", slotid, slot_w6.id));
}
var ow8 = getObjectByStateSlot(state, slot_w8);
if (ow8 != ow6 && ow8 != null)
{
menuHtml += getRowMenuItemHtml(localizer.dressSameItem + ' ' + ow8.caption, format("onItemWearFrom('{0}', '{1}')", slotid, slot_w8.id));
}
}
if (slot.id == 'w8')
{
var ow6 = getObjectByStateSlot(state, slot_w6);
if (ow6 != null)
{
menuHtml += getRowMenuItemHtml(localizer.dressSameItem + ' ' + ow6.caption, format("onItemWearFrom('{0}', '{1}')", slotid, slot_w6.id));
}
var ow7 = getObjectByStateSlot(state, slot_w7);
if (ow7 != ow6 && ow7 != null)
{
menuHtml += getRowMenuItemHtml(localizer.dressSameItem + ' ' + ow7.caption, format("onItemWearFrom('{0}', '{1}')", slotid, slot_w7.id));
}
}
for (var catid in categories)
{
if (categories[catid].slot == slotid)
{
menuHtml += getRowMenuItemHtml(categories[catid].caption, format("onCategorySelect('{0}', '{1}', '{2}')", state.id, slotid, catid));
}
}
var isSpellSlot = 0;
for (var SpellFinder = 100; SpellFinder <= 109; SpellFinder++)
{ if (slot.id == 'w'+SpellFinder) { isSpellSlot = 1 ;} }
if (isSpellSlot == 1)
{
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.dropAllSpells, format("DropAllScrolls('{0}')", state.id));
}
if (o != null && origin != null)
{
var hasExtensions = false;
menuHtml += getRowMenuSeparatorHtml();
if (!('fakebase' in origin))
{
if (('upgrade' in o) || ('wasUpgrade' in o))
{
hasExtensions = true;
menuHtml += getRowMenuItemHtml(localizer.upgradeObject, format("onUpgradeObject('{0}', '{1}', '')", state.id, slot.id));
}
}
if (o.adjustment || ('setlinks' in o))
{
hasExtensions = true;
menuHtml += getRowMenuItemHtml(localizer.fitObject, format("onFitObject('{0}', '{1}')", state.id, slot.id));
}
if (slot.id == 'w4')
{
hasExtensions = true;
if (state.fitArmor)
{
menuHtml += getRowMenuItemHtml(localizer.unfitArmor, format("onFitArmor('{0}', false)", state.id));
}
else
{
menuHtml += getRowMenuItemHtml(localizer.fitArmor, format("onFitArmor('{0}', true)", state.id));
}
}
if (slot.id == 'w3' || slot.id == 'w10')
{
var ocat = categories[o.category];
if (('canBeSharpen' in ocat) && ocat.canBeSharpen)
{
hasExtensions = true;
var minlv=0;
var allowNewSharp=1;
if ('required' in o)
{ if ('level' in o.required)
{
minlv=o.required.level;
//if ('artefact' in o) { if (minlv < 10) { allowNewSharp=0; } }
}
}
var isStaff=0;
if ('category' in o)
{
if (o.category == 'staffs') { isStaff=1; }
}
var isDouble=0;
if ('properties' in o)
{
if ('twohandled' in o.properties)
{
isDouble=1;
}
}
var actionTitle = localizer.sharpening;
if('category' in o && o.category === 'staffs') {
actionTitle = localizer.staffSpelling;
}
menuHtml += getRowMenuItemHtml(actionTitle, format("onSharpeningMenu('{0}','{1}','{2}','{3}','{4}')", slot.id, minlv, allowNewSharp, isStaff, isDouble));
}
}
// if (('canCharm' in slot) && !('artefact' in o))
if ('category' in o)
{
if (('canRune' in categories[o.category]) && ((o.artefact === undefined) || (o.artefact === false)))
{
hasExtensions = true;
menuHtml += getRowMenuItemHtml(localizer.rune, format("ShowCatRunes('{0}', '{1}', '{2}')", o.category, state.id, slot.id));
//menuHtml += getRowMenuItemHtml(localizer.rune, format("alert('Coming soon...')"));
if ('wasRuned' in o)
{
menuHtml += getRowMenuItemHtml(localizer.unRune, format("onUnRuneObject('{0}', '{1}', '')", state.id, slot.id));
}
}
}
if (('modify' in o) && ('stats' in o.modify)) {
hasExtensions = true;
var ki = o.modify.stats;
menuHtml += getRowMenuItemHtml(localizer.addStats, format("onaddStats('{0}', '{1}', '{2}')", state.id, slot.id,ki));
if ('wasAdded' in o)
{
menuHtml += getRowMenuItemHtml(localizer.unaddStats, format("onUnaddStats('{0}', '{1}', '')", state.id, slot.id));
}
}
if ('canCharm' in slot)
{
hasExtensions = true;
menuHtml += getRowMenuItemHtml(localizer.charmObject, format("onCharmObject('{0}', '{1}', '')", state.id, slot.id));
if ('wasCharmed' in o)
{
menuHtml += getRowMenuItemHtml(localizer.uncharmObject, format("onUncharmObject('{0}', '{1}', '')", state.id, slot.id));
}
}
if (hasExtensions)
{
menuHtml += getRowMenuSeparatorHtml();
}
menuHtml += getRowMenuItemHtml(localizer.dropItem, format("onObjectDrop('{0}', '{1}')", state.id, slotid));
}
if (o != null)
{
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.showObjectData, format("openObjectData('{0}')", slotid));
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
showMenu(menuHtml);
if (is.ie)
{
window.event.returnValue = false;
}
return false;
}
function getItemPropTNMRBHtml(mf, total, natural, modify, maxv, req, noLabel, battlemf)
{
var html = ((noLabel != null) && noLabel) ? '': (getItemPropLabel(mf) + ': ');
var hint = '';
/*if (natural !== 0 || modify !== 0)
{
if (natural !== 0)
{
hint += localizer.describeNativeStats + getItemPropFormattedValue(mf, natural);
}
if (modify !== 0)
{
hint += (modify >= 0) ? '+' : '';
hint += getItemPropFormattedValue(mf, modify);
hint += localizer.describeSetStats;
}
//hint += '.';
}*/
html += ' <span';
if (hint != '')
{
html += ' title="' + hint + '"';
}
html += '>';
html += getItemPropFormattedValue(mf, total, maxv);
html += '</span>';
if (battlemf != 0)
{
html += '<span title="от зверя только в бою">';
html += (battlemf >= 0) ? '+' : '';
html += getItemPropFormattedValue(mf, battlemf);
html += '</span>';
}
if (req != null && req > 0)
{
html += ', <span title="' + localizer.requiredHint + '">';
var s = ' [';
s += getItemPropFormattedValue(mf, req);
if (modify != 0)
{
var reqnatural = req - modify;
if (reqnatural > 0)
{
s += ' (';
s += getItemPropFormattedValue(mf, reqnatural);
s += ')';
}
}
s += ']';
if (req > total)
{
s = s.fontcolor('red');
}
html += s;
html += '</span>';
}
return html;
}
function getItemPropAdvWeaponHtml(mf, vobj, maxv, noLabel)
{
var html = '';
if (noLabel == null || !noLabel)
{
html += getItemPropLabel(mf) + ': ';
}
if (vobj == null)
{
html += '-';
return html;
}
var vsum = vobj.minv + vobj.maxv;
var fv = getItemPropFormattedValue(mf, vobj.minv);
fv += ' - ';
fv += getItemPropFormattedValue(mf, vobj.maxv);
if (maxv != null && vsum < maxv)
{
fv = fv.fontcolor('blue');
}
else
{
fv = fv.fontcolor('darkgreen');
}
html += fv;
return html;
}
function getWeaponSkillValueOf(state, wo, skillname)
{
var skill = 0;
if (skillname in state.results)
{
skill = state.results[skillname];
}
if ('weaponskill' in state.results)
{
skill += state.results.weaponskill;
}
if (('properties' in wo) && (skillname in wo.properties))
{
skill += wo.properties[skillname];
}
if (('properties' in wo) && ('weaponskill' in wo.properties))
{
skill += wo.properties.weaponskill;
}
if (isTwohandledWeapon(wo)) {
skill *= 2;
}
return skill;
}
function getWeaponSkillData(state, wslot)
{
var wo = getObjectByStateSlot(state, wslot);
if ((wo == null) || (wo.slot != 'w3'))
{
return {name: null, value: 0};
}
var skillname = null;
if ('required' in wo)
{
for (var i = 0; i < knownWeaponSkills.length; i++)
{
if (knownWeaponSkills[i] in wo.required)
{
skillname = knownWeaponSkills[i];
break;
}
}
}
if ((skillname == null) && ('skillname' in categories[wo.category]))
{
skillname = categories[wo.category].skillname;
}
if (skillname == null)
{
return {name: null, value: 0};
}
var v = getWeaponSkillValueOf(state, wo, skillname);
return {name: skillname, value: v};
}
function getWeaponSkillValue(state, wslot)
{
var d = getWeaponSkillData(state, wslot);
return d.value;
}
function hasTwoWeapons(state)
{
var w3o = getObjectByStateSlot(state, slot_w3);
if (w3o == null)
{
return false;
}
var w10o = getObjectByStateSlot(state, slot_w10);
if ((w10o == null) || (w10o.slot != slot_w3.id))
{
return false;
}
return true;
}
function getDresserInfoPaneWeaponHtml(state, wslot)
{
var wo = getObjectByStateSlot(state, wslot);
var baseIndices = calculateBaseWeaponIndices(state, wslot, wo);
if (wo == null && wslot.id != slot_w3.id)
{
return '';
}
var html = '<tr><td colspan="2"><hr size="1" noshade="noshade" /></td></tr>';
html += '<tr><td valign="top"><b>';
html += localizer.strikeGroup;
html += '</b></td><td valign="top"><font color="#336699"><b>';
var caption = (wo == null) ? localizer.fists : wo.caption;
html += caption;
html += '</b></font></td></tr>';
var chapterHtml = '';
for (var mf in knownAdvWeaponModifiers)
{
if (!item_props[mf].view)
{
continue;
}
var vt = (mf in state[wslot.id + 'props']) ? state[wslot.id + 'props'][mf] : null;
var mvt = (vt != null) ? (vt.minv + vt.maxv) : 0;
for (var staten in dressStates)
{
var astate = dressStates[staten];
var avt1 = (mf in astate.w3props) ? astate.w3props[mf] : null;
var mavt1 = (avt1 != null) ? (avt1.minv + avt1.maxv) : 0;
var avt2 = (mf in astate.w10props) ? astate.w10props[mf] : null;
var mavt2 = (avt1 != null) ? (avt1.minv + avt1.maxv) : 0;
if (mvt < mavt1)
{
mvt = mavt1;
}
if (mvt < mavt2)
{
mvt = mavt2;
}
}
if (mvt != 0)
{
chapterHtml += '<tr><td valign="top">';
chapterHtml += getItemPropLabel(mf);
chapterHtml += ': </td><td valign="top">';
chapterHtml += getItemPropAdvWeaponHtml(mf, vt, mvt, true);
chapterHtml += '</td></tr>';
}
}
if (chapterHtml)
{
html += chapterHtml;
html += '<tr><td><hr class="dashed" /></td><td><a href="#" class="TLink" onclick="showDamagePane(); return false"><small>' + localizer.showDetails + '</small></a></td></tr>';
chapterHtml = '';
}
for (var i = 0; i < knownWeaponModifiers.length; i++)
{
var mf = knownWeaponModifiers[i];
if (mf == '-')
{
if (chapterHtml)
{
html += chapterHtml + '<tr><td colspan="2"><hr class="dashed" /></td></tr>';
chapterHtml = '';
}
continue;
}
if (!item_props[mf].view)
{
continue;
}
if (['power', 'thrustpower', 'sabrepower', 'crushpower', 'cutpower'].indexOf(mf) != -1) {
var vn = baseIndices.powermf + getPowerMfValue(state, wslot, 'power'),
vm = (mf !== 'power' ? getPowerMfValue(state, wslot, mf) : 0),
vt = vn + vm,
mvt = vt;
} else {
var vn = (mf in state.natural) ? state.natural[mf] : 0;
var vm = (mf in state[wslot.id + 'props']) ? state[wslot.id + 'props'][mf] : 0;
var vt = vn + vm;
var mvt = vt;
for (var staten in dressStates)
{
var astate = dressStates[staten];
var avn = (mf in astate.natural) ? astate.natural[mf] : 0;
var avm1 = (mf in astate.w3props) ? astate.w3props[mf] : 0;
var avm2 = (mf in astate.w10props) ? astate.w10props[mf] : 0;
var avt1 = avn + avm1;
var avt2 = avn + avm2;
if (mvt < avt1)
{
mvt = avt1;
}
if (mvt < avt2)
{
mvt = avt2;
}
}
}
if (mvt != 0 || vn != 0 || vm != 0)
{
chapterHtml += '<tr><td valign="top">';
chapterHtml += getItemPropLabel(mf);
chapterHtml += ': </td><td valign="top">';
chapterHtml += getItemPropTNMRBHtml(mf, vt, vn, vm, mvt, null, true, 0);
chapterHtml += '</td></tr>';
}
}
if (chapterHtml)
{
html += chapterHtml;
}
return html;
}
function getDresserInfoPaneCombatSpellHtml(state, spellid)
{
var r = state.combatSpells[spellid];
var o = getObjectById(spellid);
var html = '<tr><td colspan="2"><hr size="1" noshade="noshade" /></td></tr>';
if (isHeavyArmor(getObjectByStateSlot(state, slot_w4)))
{
html += format(localizer.badHeavyArmor,
getMenuItemHtml(localizer.here, format("onObjectDrop('{0}', 'w4')", state.id))
);
}
if (areNotMagicGloves(getObjectByStateSlot(state, slot_w11)))
{
html += format(localizer.badGloves,
getMenuItemHtml(localizer.here, format("onObjectDrop('{0}', 'w11')", state.id))
);
}
html += '<tr><td valign="top"><b>';
html += localizer.strikeGroup;
html += '</b></td><td valign="top"><font color="#336699"><b>';
html += o.caption;
html += '</b></font></td></tr>';
var chapterHtml = '';
for (var mf in r)
{
if (!item_props[mf].view)
{
continue;
}
var vt = r[mf];
var mvt = (vt.minv + vt.maxv);
for (var staten in dressStates)
{
var astate = dressStates[staten];
var avt = (spellid in astate.combatSpells) ? astate.combatSpells[spellid][mf] : null;
var mavt = (avt != null) ? (avt.minv + avt.maxv) : 0;
if (mvt < mavt)
{
mvt = mavt;
}
}
if (mvt != 0)
{
chapterHtml += '<tr><td valign="top">';
chapterHtml += getItemPropLabel(mf);
chapterHtml += ': </td><td valign="top">';
chapterHtml += getItemPropAdvWeaponHtml(mf, vt, mvt, true);
chapterHtml += '</td></tr>';
}
}
if (chapterHtml)
{
html += chapterHtml;
html += '<tr><td colspan="2"><hr class="dashed" /></td></tr>';
chapterHtml = '';
}
if (chapterHtml)
{
html += chapterHtml;
}
return html;
}
function getDresserInfoPaneCombatTrickHtml(ctrick)
{
var trick = tricks[ctrick.name];
var html = '<tr><td colspan="2"><hr size="1" noshade="noshade" /></td></tr>';
html += '<tr><td valign="top"><b>';
html += localizer.trick;
html += '</b></td><td valign="top"><font color="#336699"><b>';
html += ctrick.caption;
html += '</b></font></td></tr>';
var chapterHtml = '';
for (var mf in ctrick)
{
if (mf == 'name' || mf == 'caption')
{
continue;
}
if (!item_props[mf].view)
{
continue;
}
var vt = ctrick[mf];
var mvt = vt;
for (var staten in dressStates)
{
var astate = dressStates[staten];
var avt = (ctrick.name in astate.combatSpells) ? astate.combatSpells[ctrick.name][mf] : 0;
if (mvt < avt)
{
mvt = avt;
}
}
chapterHtml += '<tr><td valign="top">';
chapterHtml += getItemPropLabel(mf);
chapterHtml += ': </td><td valign="top">';
chapterHtml += getItemPropFormattedValue(mf, vt, mvt);
chapterHtml += '</td></tr>';
}
var targeter = null;
if ('attack' in trick)
{
targeter = trick.attack;
} else if ('healing' in trick)
{
targeter = trick.healing;
}
if (targeter != null)
{
var count = 'Одна цель';
if ('mincount' in targeter)
{
count = targeter.mincount + ' - ' + targeter.maxcount + ' целей';
}
else if ('count' in targeter)
{
count = targeter.count + ' целей';
}
chapterHtml += '<tr><td valign="top">';
chapterHtml += 'Количество целей';
chapterHtml += ': </td><td valign="top">';
chapterHtml += count;
}
if (chapterHtml)
{
html += chapterHtml;
html += '<tr><td colspan="2"><hr class="dashed" /></td></tr>';
chapterHtml = '';
}
if (chapterHtml)
{
html += chapterHtml;
}
return html;
}
function getDefElixSecondValue(defelix, firstValue)
{
var index = 0;
for (var i = 0; i < defelix.values.length; i++)
{
if (defelix.values[i] > firstValue)
{
break;
}
index = i;
}
return defelix.values2[index];
}
function toggleViewOption(isItemProp, prop)
{
if (isItemProp)
{
item_props[prop].view = !item_props[prop].view;
}
else
{
common_props[prop].view = !common_props[prop].view;
}
}
function getDresserInfoPaneTabHtml(tabText, tabFunc, on)
{
var html = '';
var classn = on ? 'activeLink' : 'usualLink';
var onclick = on ? '' : (' onclick="' + tabFunc + '"');
html += format('<li class="{0}"><a href="javascript:;"{1}>{2}</a></li>', classn, onclick, tabText);
return html;
}
function getDresserInfoPaneTabsHtml(tabIndex)
{
var state = activeState;
var html = '';
html += '<br />';
html += '<div class="dtab"><ul class="dtab" style="float:right; margin-right: 16px;">';
html += getDresserInfoPaneTabHtml(localizer.infoPaneHeader, 'showInfoPane()', (tabIndex == 0));
html += getDresserInfoPaneTabHtml(localizer.damagePaneHeader, 'showDamagePane()', (tabIndex == 4));
html += getDresserInfoPaneTabHtml(localizer.componentsPaneHeader, 'showComponentsPane()', (tabIndex == 5));
//html += getDresserInfoPaneTabHtml(localizer.listPaneHeader, 'showListPane()', (tabIndex == 1));
if (state != null && state.pet != null)
{
html += getDresserInfoPaneTabHtml(localizer.petPaneHeader, 'showPetPane()', (tabIndex == 2));
}
// html += getDresserInfoPaneTabHtml(localizer.viewOptionsPaneHeader, 'showViewOptionsPane()', (tabIndex == 3));
html += '</ul></div>';
return html;
}
function getDresserPetPaneHtml()
{
var state = activeState;
if (state == null || state.pet == null)
{
return '';
}
var html = '';
var pet = pets[state.pet.n];
var pl = pet.levels['L' + state.pet.level];
html += '<div style="width: 100%">';
html += getDresserInfoPaneTabsHtml(2);
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab-content"><tr><td colspan="2">';
html += '<table width="100%" border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
html += '<tr><td>';
html += '<b>Информация о выбранном питомце</b><br />';
html += 'Тип: ' + pet.caption;
for (var name in pl)
{
if (name in item_props)
{
html += '<br />' + getItemPropLabel(name) + ': ' + getItemPropFormattedValue(name, pl[name]);
}
}
if ('foods' in pet)
{
html += '<hr class="dashed" />';
html += '<small>Еда</small><br />';
for (var foodn in pet.foods)
{
var food = pet.foods[foodn];
html += format('<img src="{0}{1}.gif" title="{2}" alt="{2}" width="60" height="60" border="0" />', itemImgPath, food.name, food.caption);
}
}
html += '</td></tr>';
html += '</table>';
html += '</td></tr>';
html += '</table>';
html += '</td></tr></table>';
html += '</div>';
return html;
}
function getCharmChooserHtml(sloti)
{
var html = '';
var slot = getSlotByIndex(sloti);
var o = getObjectByStateSlot(activeState, slot);
html += '<table cellspacing="0" cellpadding="0" border="0"><tr><td>';
html += format(localizer.charmHint, clanImgPath);
html += '<div style="text-align: right;">';
html += '<table cellspacing="0" cellpadding="0" border="0"><tr>';
for (var i = 0; i < knownPredefinedCharms.length; i++)
{
var charm = knownPredefinedCharms[i];
if ('categories' in charm)
{
var found = false;
for (var ci = 0; ci < charm.categories.length; ci++)
{
if (charm.categories[ci] == o.category)
{
found = true;
break;
}
}
if (!found)
{
continue;
}
}
var text = '<img border="0" width="40" height="25" src="' + itemImgPath + charm.id + '.gif" + title="Наложить ' + charm.caption + '" />';
var action = "doPredefinedCharm('" + sloti + "', '" + charm.v + "')";
html += getCellMenuItemHtml(text, action);
}
html += '</tr></table>';
html += '</div>';
html += '<label for="charm_mf_name">' + localizer.charmChooseMf + ':</label><br />';
html += '<select class="ABText80" id="charm_mf_name">';
for (var ipi in item_props)
{
var prop = item_props[ipi];
if ('nocharm' in prop)
{
continue;
}
html += format('<option value="{0}">{1}</option>', ipi, prop.lbl);
}
html += '</select><br />';
html += '<label for="charm_mf_value">' + localizer.charmEnterV + ':</label><br />';
html += '<input class="ABText80" id="charm_mf_value" type="text" maxlength="5" value="" /><br />';
//html += '<input id="charm_mf_replace" type="checkbox" value="replace" />';
//html += '<label for="charm_mf_replace">' + localizer.charmReplace + '.</label><br />';
if (!('canCharm' in slot))
{
html += '<div style="color: red; font-size: x-small;">Зачарование этого слота в БК невозможно.</div>';
}
/*if ('artefact' in o)
{
if ('required' in o)
{
if ('level' in o.required)
{
if (o.required.level < 10)
{ html += '<div style="color: red; font-size: x-small;">Зачарование артефактов менее 10-го уровня в БК невозможно.</div>'; }
}
}
}*/
html += '<input class="inpButton" type="button" value="' + localizer.charmObject + '" onclick="doCharm(' + sloti + ')" />';
html += ' <input class="inpButton" type="button" value="' + localizer.cancel + '" onclick="hideMenu()" />';
html += '</td></tr></table>';
return html;
}
///////////////////////////////////////////////////////////////////////////////////
function getASChooserHtml(sloti,numb)
{
var html = '';
var slot = getSlotByIndex(sloti);
var o = getObjectByStateSlot(activeState, slot);
html += '<table cellspacing="0" cellpadding="0" border="0"><tr><td>';
html += format(localizer.addstatsHint, clanImgPath);
html += '<div style="text-align: left;">';
html += '<table cellspacing="0" cellpadding="0" border="0"><tr>';
html += '<td><div id="awsdstats">Количество увеличений:';
html += '<input type="hidden" id="itemstat" class="ABTextAA" value="'+numb+'">';
html += '<input type="text" id="alst" class="ABTextAA" value="'+numb+'" READONLY></div></td><tr><td>';
html += '<input class="ABTextAA" id="add_strength" type="text" maxlength="3" value="0" READONLY/> Сила</td><td>'
html += '<a onclick="item_ad_p(\'add_strength\')" href="javascript:;"><img src="images/plus.gif" alt="увеличить" border=0> </a>';
html += '<a onclick="item_ad_m(\'add_strength\')" href="javascript:;"><img src="images/minus.gif" alt="уменшить" border=0> </a>';
html += '</td></tr><tr><td>';
html += '<input class="ABTextAA" id="add_dexterity" type="text" maxlength="3" value="0" READONLY /> Ловкость</td><td>';
html += '<a onclick="item_ad_p(\'add_dexterity\')" href="javascript:;"><img src="images/plus.gif" alt="увеличить" border=0> </a>';
html += '<a onclick="item_ad_m(\'add_dexterity\')" href="javascript:;"><img src="images/minus.gif" alt="уменшить" border=0> </a>';
html += '</td></tr><tr><td>';
html += '<input class="ABTextAA" id="add_intuition" type="text" maxlength="3" value="0" READONLY/> Интуиция</td><td>';
html += '<a onclick="item_ad_p(\'add_intuition\')" href="javascript:;"><img src="images/plus.gif" alt="увеличить" border=0> </a>';
html += '<a onclick="item_ad_m(\'add_intuition\')" href="javascript:;"><img src="images/minus.gif" alt="уменшить" border=0> </a>';
html += '</td></tr><tr><td>';
html += '<input class="ABTextAA" id="add_intellect" type="text" maxlength="3" value="0" READONLY /> Интеллект</td><td>';
html += '<a onclick="item_ad_p(\'add_intellect\')" href="javascript:;"><img src="images/plus.gif" alt="увеличить" border=0> <a>';
html += '<a onclick="item_ad_m(\'add_intellect\')" href="javascript:;"><img src="images/minus.gif" alt="уменшить" border=0> <a>';
html += '</td></tr></table>';
html += '</div>';
html += '</td></tr></table>';
html += '<input class="inpButton" type="button" value="' + localizer.addstatsObject + '" onclick="doAddStats(' + sloti + ')" />';
html += ' <input class="inpButton" type="button" value="' + localizer.cancel + '" onclick="hideMenu()" />';
html += '</td></tr></table>';
return html;
}
function item_ad_p(stat)
{
as = document.getElementById('alst');
var istat = document.getElementById('itemstat').value;
elem = document.getElementById(stat);
document.getElementById(stat).focus();
if ((parseInt(as.value) <= parseInt(istat)) && (parseInt(as.value) > 0))
{
elem.value ++;
as.value--;
}
document.getElementById(stat).blur();
}
function item_ad_m(stat)
{
as = document.getElementById('alst');
elem = document.getElementById(stat);
var istat = document.getElementById('itemstat').value;
document.getElementById(stat).focus();
if ((as.value <=istat) && (as.value >= 0) )
{
if (elem.value >= 1)
{
elem.value --;
as.value ++;
}
}
document.getElementById(stat).blur();
}
function getDresserViewOptionsPaneHtml()
{
var html = '';
html += '<div style="width: 100%">';
html += getDresserInfoPaneTabsHtml(3);
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab-content"><tr><td colspan="2">';
html += '<table width="100%" border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
html += '<tr><td>';
html += localizer.indicesPaneHeader;
for (var ci in common_props)
{
var prop = common_props[ci];
html += format('<input onclick="toggleViewOption(false, {2})" type="checkbox" id="{0}" name="{0}"{1} /><label for="{0}">', ci, (prop.view ? ' checked="true"' : ''), format("'{0}'", ci));
html += htmlstring(prop.lbl);
html += '</label><br />';
}
html += '<hr class="dashed" />';
for (var ipi in item_props)
{
var prop = item_props[ipi];
html += format('<input onclick="toggleViewOption(true, {2})" type="checkbox" id="{0}" name="{0}"{1} /><label for="{0}">', ipi, (prop.view ? ' checked="true"' : ''), format("'{0}'", ipi));
html += htmlstring(prop.lbl);
html += '</label><br />';
}
html += '</td></tr>';
html += '</table>';
html += '</td></tr>';
html += '</table>';
html += '</td></tr></table>';
html += '</div>';
return html;
}
function getDresserListPaneHtml(state)
{
var html = '';
html += '<div style="width: 100%">';
html += getDresserInfoPaneTabsHtml(1);
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab-content"><tr><td colspan="2">';
html += '<table width="100%" border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
html += '<tr><td>';
html += '<b>' + localizer.naturalStats + '</b><br />';
for (var i = 0; i < knownStats.length; i++)
{
html += getItemPropLabel(knownStats[i]);
html += ': ';
html += getItemPropFormattedValue(knownStats[i], state.natural[knownStats[i]]);
html += '<br />';
}
html += '<hr class="dashed" />';
html += '<b>' + localizer.resultStats + '</b><br />';
for (var i = 0; i < knownStats.length; i++)
{
html += getItemPropLabel(knownStats[i]);
html += ': ';
html += getItemPropFormattedValue(knownStats[i], state.results[knownStats[i]]);
html += '<br />';
}
html += '<hr class="dashed" />';
html += '<b>' + localizer.wearedItems + '</b><br />';
for (var i = 0; i < slots.length; i++)
{
var o = getObjectByStateSlot(state, slots[i]);
if (o == null)
{
continue;
}
html += '<a class="ISLink" href="#" onclick="return dcInfoSpace(';
var o2 = getObjectById(state.objects[slots[i].index]);
html += "'" + o2.id + "', 'goodies'";
html += ')" >';
html += htmlstring(o.caption);
html += ' <img alt="Информация" src="' + infospaceImgPath + 'info.gif" width="12" height="11" border="0" /></a>';
html += '<br />';
}
html += '<hr class="dashed" />';
html += '</td></tr>';
html += '</table>';
html += '</td></tr>';
html += '</table>';
html += '</td></tr></table>';
html += '</div>';
return html;
}
function showPetPane()
{
var state = activeState;
if (state == null)
{
return;
}
document.getElementById('infopane' + state.id).innerHTML = getDresserPetPaneHtml();
}
function showViewOptionsPane()
{
var state = activeState;
if (state == null)
{
return;
}
document.getElementById('infopane' + state.id).innerHTML = getDresserViewOptionsPaneHtml();
}
function showListPane()
{
var state = activeState;
if (state == null)
{
return;
}
document.getElementById('infopane' + state.id).innerHTML = getDresserListPaneHtml(state);
}
function showDamagePane()
{
var state = activeState;
if (state == null)
{
return;
}
document.getElementById('infopane' + state.id).innerHTML = getDresserDamagePaneHtml(state);
}
function showComponentsPane()
{
var state = activeState;
if (state == null)
{
return;
}
document.getElementById('infopane' + state.id).innerHTML = getDresserComponentsPaneHtml(state);
}
function showPetSkillProps()
{
var state = activeState;
if (state == null)
{
return;
}
var pet = pets[state.pet.n];
var pl = pet.levels['L' + state.pet.level];
showPopup(getObjectDescHtml(state, pl.skill));
}
function getDamageHtml(caption, damageData)
{
var html = '';
var chapterHtml = '';
for (var mf in knownAdvWeaponModifiers)
{
if (!item_props[mf].view)
{
continue;
}
var vt = (mf in damageData) ? damageData[mf] : null;
var mvt = (vt != null) ? (vt.minv + vt.maxv) : 0;
if (mvt != 0)
{
chapterHtml += '<tr><td valign="top">';
chapterHtml += getItemPropLabel(mf);
chapterHtml += ': </td><td valign="top">';
chapterHtml += getItemPropAdvWeaponHtml(mf, vt, mvt, true);
chapterHtml += '</td></tr>';
}
}
if (item_props._power_v.view && ('_power_v' in damageData))
{
chapterHtml += '<tr><td valign="top">';
chapterHtml += getItemPropLabel('_power_v');
chapterHtml += ': </td><td valign="top">';
chapterHtml += getItemPropFormattedValue('_power_v', damageData._power_v);
chapterHtml += '</td></tr>';
}
if (chapterHtml)
{
html += '<tr><td><b>' + caption + '</b></td></tr>';
html += chapterHtml;
html += '<tr><td colspan="2"><hr class="dashed" /></td></tr>';
}
return html;
}
function getDresserDamagePaneHtmlFor(state, wslot)
{
var wo = getObjectByStateSlot(state, wslot);
if (wo == null && wslot.id != slot_w3.id)
{
return '';
}
var html = '<tr><td colspan="2"><hr size="1" noshade="noshade" /></td></tr>';
html += '<tr><td valign="top"><b>';
html += localizer.strikeGroup;
html += '</b></td><td valign="top"><font color="#336699"><b>';
var caption = (wo == null) ? localizer.fists : wo.caption;
html += caption;
html += '</b></font></td></tr>';
var wd = state[wslot.id + 'props'];
html += getDamageHtml(localizer.averageDamage + ':', wd);
var wsd = getWeaponSkillData(state, wslot);
if (wsd != null && wsd.name != null)
{
html += '<tr><td valign="top">';
html += getItemPropLabel(wsd.name);
html += ': </td><td valign="top">';
html += wsd.value;
html += '</td></tr>';
html += '<tr><td colspan="2"><hr class="dashed" /></td></tr>';
}
for (var attackn in wd.damages)
{
var d = wd.damages[attackn];
var caption = localizer['attackt' + attackn];
caption += ' (' + d.attack.freal + '%):';
html += getDamageHtml(caption, d);
}
return html;
}
function getDresserDamagePaneHtml(state)
{
var html = '';
html += '<div style="width: 100%">';
html += getDresserInfoPaneTabsHtml(4);
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab-content"><tr><td colspan="2">';
html += '<table width="100%" border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;"><tr>';
var wo3 = getObjectByStateSlot(state, slot_w3);
var wo10 = getObjectByStateSlot(state, slot_w10);
html += '<td valign="top"><table border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
html += getDresserDamagePaneHtmlFor(state, slot_w3);
html += '</table></td>';
if ((wo10 != null) && (wo10.slot == 'w3'))
{
if (!areSameObjectsWeared(state, slot_w3, slot_w10))
{
html += '<td valign="top"><table border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
html += getDresserDamagePaneHtmlFor(state, slot_w10);
html += '</table></td>';
}
else
{
html += '<td valign="top"><table border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
html += '<tr><td colspan="2"><hr size="1" noshade="noshade" /></td></tr>';
html += '<tr><td colspan="2" valign="top">';
html += localizer.sameWeapon;
html += '</td></tr>';
html += '</table></td>';
}
}
html += '</table></td>';
html += '</tr></table>';
html += '</td></tr></table>';
html += '</div>';
return html;
}
function getDresserComponentsPaneHtml(state)
{
var html = '';
html += '<div style="width: 100%">';
html += getDresserInfoPaneTabsHtml(5);
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab-content"><tr><td colspan="2">';
html += '<table width="100%" border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;"><tr>';
html += '<td valign="top">';
var eps = {},
isListEmpty = true;
for (var epn in dressExchangePoints)
{
var ep = dressExchangePoints[epn];
eps[epn] = { id: epn, caption: ep.caption, description: ep.description, items: [] };
}
html += '<b>' + localizer.componentsPaneHeader + '</b>' + '<br />' + '<br />';
var chtml = '';
var totals = {};
for (var i = 0; i < slots.length; i++)
{
var slot = slots[i];
var o = getObjectByStateSlot(state, slot);
if (o == null) continue;
if ('requireditems' in o)
{
for (var oi in o.requireditems)
{
eps[oi].items.push({ id: o.id, caption: o.caption, items: o.requireditems[oi].items});
}
}
if (!('clist' in o)) continue;
chtml += '<br /><b><i>' + o.caption + '</i></b>: ';
for (var ccn in o.clist)
{
var firstc = true;
for (var cn in o.clist[ccn])
{
var c = o.clist[ccn][cn];
if (!(cn in totals)) totals[cn] = {id:cn, count:0, caption:c.caption};
totals[cn].count += c.count;
if (firstc) firstc = false; else chtml += ',';
chtml += ' ' + c.caption + ' - ' + c.count;
}
chtml += '.';
}
}
// статовый элик (предки, рульф).
if (state.statElix != null) {
if (state.statElix.elixn in knownElix && 'id' in knownElix[state.statElix.elixn] && knownElix[state.statElix.elixn].id in dressItems) {
let elix = knownElix[state.statElix.elixn].id;
if (elix in dressItems) {
let elixObj = dressItems[elix];
if ('requireditems' in elixObj) {
for (var oi in elixObj.requireditems) {
eps[oi].items.push({ id: elixObj.id, caption: elixObj.caption, items: elixObj.requireditems[oi].items});
}
}
}
}
}
if (chtml != '')
{
html += '<br /><b><i>' + 'Создание' + '</i></b>';
html += chtml;
html += '<br /><i><b>Всего</b></i>: ';
html +- '<ul>';
var firstc = true;
for (var cn in totals)
{
var c = totals[cn];
if (firstc) firstc = false; //else html += '';
html += '<li> ' + c.caption + ' - ' + c.count + ' </li>';
}
html += '</ul>';
html += '<br />';
}
for (var epi in eps)
{
var ep = eps[epi];
var ephtml = '';
totals = {};
for (var i in ep.items)
{
var item = ep.items[i];
ephtml += '<br /><b>' + item.caption + '</b>: ';
var firstc = true;
isListEmpty = false;
for (var ci in item.items)
{
var c = item.items[ci];
if (!(ci in totals)) totals[ci] = {id:ci, count:0, caption:c.caption};
totals[ci].count += c.count;
if (firstc) firstc = false; else ephtml += ',';
ephtml += ' ' + c.caption + ' - ' + c.count;
}
ephtml += '.<br />';
}
if (ephtml != '')
{
html += '<br /><b title="' + ep.description + '"><i>' + ep.description + '</i></b><br />';
html += ephtml;
/*html += '<i>Всего</i>: ';
var firstc = true;
for (var ci in totals)
{
var c = totals[ci];
if (firstc) firstc = false; else html += ',';
html += ' ' + c.caption + ' - ' + c.count;
}*/
html += '<br />';
}
}
if (isListEmpty === true) {
html += 'Дополнительных действий не требуется.';
}
html += '</td>';
html += '</tr></table>';
html += '</td></tr></table>';
html += '</div>';
return html;
}
function getMatvikZoneValue(v)
{
v = 1 - Math.pow(0.5, (v / 250.0));
v *= 100.0;
v = Math.floor(v * 100.0 + 0.5) / 100.0;
return v;
}
function getMatvikZoneValue800(v)
{
if (v > 800) v = 800;
return getMatvikZoneValue(v);
}
function getMatvikZoneValue1000(v)
{
if (v > 1000) v = 1000;
return getMatvikZoneValue(v);
}
function getDresserInfoPaneHtml(state)
{
var html = '';
html += '<div style="width: 100%">';
html += getDresserInfoPaneTabsHtml(0);
html += '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab-content"><tr><td colspan="2">';
html += '<table width="100%" border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
var chapterHtml = '';
for (var sloti = 0; sloti < slots.length; sloti++)
{
var slot = slots[sloti];
var o = getObjectByStateSlot(state, slot);
if (o != null && 'required' in o)
{
var needHtml = '';
var canFit = false;
if ('sex' in o.required)
{
var statesex = state.sex ? 'female' : 'male';
if (o.required.sex != statesex)
{
needHtml += localizer.badGender;
}
}
for (var mfname in o.required)
{
var rv = state.results[mfname];
var bmf = 0;
if (mfname in state.battlemf)
{
bmf = state.battlemf[mfname];
}
rv -= bmf;
if (rv < o.required[mfname])
{
if (needHtml != '')
{
needHtml += '<br />';
}
needHtml += format(localizer.reqInfo, getItemPropLabel(mfname), o.required[mfname], (o.required[mfname] - state.modify[mfname] + bmf));
canFit = true;
}
}
if (needHtml != '')
{
chapterHtml += '<tr><td colspan="2" class="hintview">';
chapterHtml += '<table class="reqinfo" width="100%" border="0"><tr><td>' + o.caption.bold() + '</td>';
chapterHtml += '<td>' + needHtml + '</td></tr></table>';
if (canFit)
{
chapterHtml += format(localizer.adjustHint, getMenuItemHtml(localizer.here, format("onFitStats('{0}')", state.id)));
}
chapterHtml += '</td></tr>';
}
}
}
/*for (var tricki = 0; tricki < state.trickSlots.length; tricki++)
{
var trickn = state.trickSlots[tricki];
var o = null;
if (trickn != null)
{
o = tricks[getJSName(trickn)];
}
if (o != null && 'required' in o)
{
var needHtml = '';
var canFit = false;
if ('sex' in o.required)
{
var statesex = state.sex ? 'female' : 'male';
if (o.required.sex != statesex)
{
needHtml += localizer.badGender;
}
}
for (var mfname in o.required)
{
var rv = state.results[mfname];
if (mfname in state.battlemf)
{
rv -= state.battlemf[mfname];
}
if (rv < o.required[mfname])
{
if (needHtml != '')
{
needHtml += '<br />';
}
needHtml += format(localizer.reqInfo, getItemPropLabel(mfname), o.required[mfname], (o.required[mfname] - state.modify[mfname]));
canFit = true;
}
}
if (needHtml != '')
{
chapterHtml += '<tr><td colspan="2" class="hintview">';
chapterHtml += '<table class="reqinfo" width="100%" border="0"><tr><td>' + o.caption.bold() + '</td>';
chapterHtml += '<td>' + needHtml + '</td></tr></table>';
if (canFit)
{
chapterHtml += format(localizer.adjustHint, getMenuItemHtml(localizer.here, format("onFitStats('{0}')", state.id)));
}
chapterHtml += '</td></tr>';
}
}
}*/
if (chapterHtml != '')
{
html += chapterHtml; // + '<tr><td colspan="2"><hr class="dashed" /></td></tr>';
}
html += '</table></td></tr>';
html += '<tr><td valign="top">';
html += '<table border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
html += '<tr><td colspan="2"><hr size="1" noshade="noshade" /></td></tr>';
chapterHtml = '';
var waddo = getObjectByStateSlot(state, slot_wadd);
if (waddo != null)
{
chapterHtml += '<tr><td valign="top">';
chapterHtml += localizer.waddInfo; //Продукты - Подарок
chapterHtml += ': </td><td valign="top">';
chapterHtml += format(
'<u onmouseout="hidePopup()" onmouseover="showItemProps2({1}, {2})">{0}</u></td></tr>',
waddo.caption,
format("'{0}'", state.id),
format("'{0}'", waddo.id)
);
}
for (i = 0; i < state.appliedSets.length; i++)
{
var set = state.appliedSets[i];
chapterHtml += '<tr><td valign="top">';
chapterHtml += localizer.set;
chapterHtml += ': </td><td valign="top">';
chapterHtml += format(
'<u onmouseout="hidePopup()" onmouseover="showSetProps({1}, {2})">{0}</u></td></tr>',
set.caption,
format("'{0}'", state.id),
format("'{0}'", set.id)
);
}
for (i = 0; i < state.appliedStrengthenings.length; i++)
{
var strengthening = state.appliedStrengthenings[i];
chapterHtml += '<tr><td valign="top">';
chapterHtml += localizer.strengthening;
chapterHtml += ': </td><td valign="top">';
chapterHtml += format(
'<u onmouseout="hidePopup()" onmouseover="showStrengtheningProps({1}, {2})">{0}</u></td></tr>',
strengthening.caption,
format("'{0}'", state.id),
format("'{0}'", strengthening.id)
);
}
if (state.statElix != null)
{
var elix = knownElix[state.statElix.elixn];
chapterHtml += '<tr><td valign="top">';
chapterHtml += localizer.statWeakness;
chapterHtml += ': </td><td valign="top">';
chapterHtml += format(
'{0} <i>{1} +{2}</i> </td></tr>',
elix.caption,
getItemPropLabel(elix.makeUp),
state.statElix.v
);
if ('makeUp2' in elix)
{
chapterHtml += '<tr><td valign="top">';
chapterHtml += localizer.statWeakness;
chapterHtml += ': </td><td valign="top">';
chapterHtml += format(
'{0} <i>{1} +{2}</i> </td></tr>',
elix.caption,
getItemPropLabel(elix.makeUp2),
elix.values2[0]
);
}
}
for (var damageelixn in state.damageElixes)
{
var damageelix = knownDamageElix[damageelixn];
var caption = damageelix.caption;
if ('buylink' in damageelix)
{
caption += ' <a title="Купить" target="_blank" class="TLink" href="' + damageelix.buylink + '">>></a>';
}
chapterHtml += format(
'<tr><td valign="top">{1}: </td><td valign="top">{0}</td></tr>',
caption,
localizer.statWeakness
);
}
for (var defelixn in state.defElixes)
{
var defelix = knownDefElix[defelixn];
chapterHtml += format(
'<tr><td valign="top">{3}: </td><td valign="top">{0}: {2} на <i>{1} ед.</i></td></tr>',
defelix.caption,
state.defElixes[defelixn],
getItemPropLabel(defelix.makeUp),
localizer.statWeakness
);
if ('makeUp2' in defelix)
{
chapterHtml += format(
'<tr><td valign="top">{3}: </td><td valign="top">{0}: {2} на <i>{1} ед.</i></td></tr>',
defelix.caption,
getDefElixSecondValue(defelix, state.defElixes[defelixn]),
getItemPropLabel(defelix.makeUp2),
localizer.statWeakness
);
}
}
if (state.pet != null)
{
var pet = pets[state.pet.n];
var pl = pet.levels['L' + state.pet.level];
if ('skill' in pl)
{
chapterHtml += '<tr><td valign="top">';
chapterHtml += localizer.appliedPetSkill;
chapterHtml += ': </td><td valign="top">';
chapterHtml += format(
'<u onmouseover="showPetSkillProps()" onmouseout="hidePopup()">{0} [{1}]</u>',
pl.skill.caption,
pl.level
);
chapterHtml += '</td></tr>';
}
}
if (state.spellIntel != 0)
{
var spell = knownApplicableSpells.spellIntel;
chapterHtml += '<tr><td valign="top">';
chapterHtml += localizer.appliedSpell;
chapterHtml += ': </td><td valign="top">';
chapterHtml += format(
'{0} <i>{1} + {2}</i> </td></tr>',
spell.caption,
getItemPropLabel(spell.makeUp),
state.spellIntel
);
}
if (state.spellBD != 0)
{
var spell = knownApplicableSpells.spellBD;
chapterHtml += '<tr><td valign="top">';
chapterHtml += localizer.appliedSpell;
chapterHtml += ': </td><td valign="top">';
chapterHtml += format(
'{0} <i>{1} + {2}</i> </td></tr>',
spell.caption,
getItemPropLabel(spell.makeUp),
state.spellBD
);
}
if (state.spellHitpoints != 0)
{
var sv = state.spellHitpoints.toString();
var shp = (state.spellHitpoints * (state.natural.endurance + state.modify.endurance)).toString();
if (state.spellHitpoints > 0)
{
sv = '+' + sv;
shp = '+' + shp;
}
var spell = (state.spellHitpoints > 0) ? knownApplicableSpells.spellHitpointsUp : knownApplicableSpells.spellHitpointsDown;
chapterHtml += '<tr><td valign="top">';
chapterHtml += localizer.appliedSpell;
chapterHtml += ': </td><td valign="top">';
chapterHtml += format(
'{0}{2} <i>{1} {3}</i></td></tr>',
spell.caption,
getItemPropLabel(spell.makeUp),
sv,
shp
);
}
for (var powerupn in state.spellPowerUps) {
var spell = getObjectById(powerupn);
if (spell !== undefined) {
var caption = spell.caption;
if ('buylink' in spell)
{
caption += ' <a title="Купить" target="_blank" class="TLink" href="' + spell.buylink + '">>></a>';
}
if (spell.id in knownPowerUps)
{
var link = '<font size="1"><a onclick="onPowerUp(event, ' + "'" + spell.id + "'" + ')" href="javascript:;">(remove)</a></font>';
}
else
{
var link = '<font size="1"><a onclick="onECRPowerUp(event, ' + "'" + spell.id + "'" + ')" href="javascript:;">(remove)</a></font>';
}
chapterHtml += '<tr><td valign="top">';
chapterHtml += localizer.appliedSpell;
chapterHtml += ': </td><td valign="top">';
chapterHtml += format('{0} на <i>{1} ед.</i>'+link+'</td></tr>', caption, state.spellPowerUps[powerupn]);
} else {
alert('Идентификатор ' + powerupn + ' более не используется и будет проигнорирован.');
delete state.spellPowerUps[powerupn];
}
}
if (chapterHtml != '')
{
html += chapterHtml + '<tr><td colspan="2"><hr class="dashed" /></td></tr>';
}
chapterHtml = '';
for (i = 0; i < knownCleanModifiers.length; i++)
{
var mfname = knownCleanModifiers[i];
if (mfname == '-')
{
if (chapterHtml != '')
{
html += chapterHtml + '<tr><td colspan="2"><hr class="dashed" /></td></tr>';
chapterHtml = '';
}
continue;
}
if (!item_props[mfname].view)
{
continue;
}
var isEditField = false;
for (j = 0; j < knownNaturalEditors.length; j++)
{
if (knownNaturalEditors[j] != '-' && knownNaturalEditors[j] == mfname)
{
isEditField = true;
break;
}
}
if (isEditField)
{
continue;
}
if (mfname in state.results)
{
var vt = state.results[mfname];
var vr = (mfname in state.required) ? state.required[mfname] : 0;
var vn = (mfname in state.natural) ? state.natural[mfname] : 0;
var vm = (mfname in state.modify) ? state.modify[mfname] : 0;
var mvt = vt;
for (var staten in dressStates)
{
var astate = dressStates[staten];
var avn = (mfname in astate.natural) ? astate.natural[mfname] : 0;
var avm = (mfname in astate.modify) ? astate.modify[mfname] : 0;
var avt = avn + avm;
if (mvt < avt)
{
mvt = avt;
}
}
/*if (mvt === 0 && vn === 0 && vm === 0 && vr === 0)
{
continue;
}*/
chapterHtml += '<tr><td valign="top">';
chapterHtml += getItemPropLabel(mfname);
chapterHtml += ': </td><td valign="top">';
chapterHtml += getItemPropTNMRBHtml(mfname, vt, vn, vm, mvt, vr, true, 0);
chapterHtml += '</td></tr>';
}
}
if (chapterHtml != '')
{
html += chapterHtml + '<tr><td colspan="2"><hr class="dashed" /></td></tr>';
}
html += '</table></td>';
html += '<td valign="top">';
html += '<table border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
var wo3 = getObjectByStateSlot(state, slot_w3);
var wo10 = getObjectByStateSlot(state, slot_w10);
if (wo3 != null || wo10 == null) {
html += getDresserInfoPaneWeaponHtml(state, slot_w3);
}
if ((wo10 != null) && (wo10.slot == 'w3'))
{
if (!areSameObjectsWeared(state, slot_w3, slot_w10))
{
html += getDresserInfoPaneWeaponHtml(state, slot_w10);
}
else
{
html += '<tr><td colspan="2"><hr size="1" noshade="noshade" /></td></tr>';
html += '<tr><td colspan="2" valign="top">';
html += localizer.sameWeapon;
html += '</td></tr>';
}
}
for (var spellid in state.combatSpells)
{
html += getDresserInfoPaneCombatSpellHtml(state, spellid);
}
/*for (var ctrickn in state.combatTricks)
{
html += getDresserInfoPaneCombatTrickHtml(state.combatTricks[ctrickn]);
}*/
html += '</table></td></tr>';
html += '<tr><td colspan="2">';
html += '<table width="100%" border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
html += '<tr><td colspan="2">';
html += '<table class="tabZ" width="100%" border="1" cellspacing="0" cellpadding="2">';
html += format(
'<tr><td><b>{0}</b></td><td align="center"><b>{1}</b></td><td align="center"><b>{2}</b></td><td align="center"><b>{3}</b></td><td align="center"><b>{4}</b></td><td align="center"><b>{5}</b></td></tr>',
localizer.zoneVariable,
localizer.zonehead,
localizer.zonebody,
localizer.zonewaist,
localizer.zoneleg,
localizer.zoneavg
);
html += '<tr><td>' + localizer.armor + '</td>';
for (var armorn in knownArmorModifiers)
{
var vobj = { minv: state.results[armorn + '1'], maxv: state.results[armorn + '2'] };
var mvt = (vobj.minv + vobj.maxv);
for (var staten in dressStates)
{
var astate = dressStates[staten];
var av1 = ((armorn + '1') in astate.results) ? astate.results[armorn + '1'] : 0;
var av2 = ((armorn + '2') in astate.results) ? astate.results[armorn + '2'] : av1;
if (mvt < (av1 + av2))
{
mvt = av1 + av2;
}
}
html += '<td align="center">' + getItemPropAdvWeaponHtml(armorn, vobj, mvt, true) + '</td>';
}
html += '</tr>';
for (var mfname in knownZoneModifiers)
{
if (!(mfname in state.results))
{
continue;
}
var vt = state.results[mfname];
var mvt = { head: 0, body: 0, waist: 0, leg: 0, avg: 0 };
for (var staten in dressStates)
{
var astate = dressStates[staten];
var avt = { head: 0, body: 0, waist: 0, leg: 0, avg: 0 };
if (mfname in astate.results)
{
avt = astate.results[mfname];
}
if (mvt.head < avt.head)
{
mvt.head = avt.head;
}
if (mvt.body < avt.body)
{
mvt.body = avt.body;
}
if (mvt.waist < avt.waist)
{
mvt.waist = avt.waist;
}
if (mvt.leg < avt.leg)
{
mvt.leg = avt.leg;
}
if (mvt.avg < avt.avg)
{
mvt.avg = avt.avg;
}
}
if (mvt.head !== 0 || mvt.body !== 0 || mvt.waist !== 0 || mvt.leg !== 0)
{
var pc = {head: getMatvikZoneValue1000(vt.head), body: getMatvikZoneValue1000(vt.body), waist: getMatvikZoneValue1000(vt.waist), leg: getMatvikZoneValue1000(vt.leg), avg: getMatvikZoneValue1000(vt.avg)};
for (var pcn in pc)
{
pc[pcn] = Math.floor(pc[pcn] * 100 + 0.5) / 100;
}
html += format(
'<tr><td>{0}</td><td align="center">{1} ({5}%)</td><td align="center">{2} ({6}%)</td><td align="center">{3} ({7}%)</td><td align="center">{4} ({8}%)</td><td align="center">{9} ({10}%)</td></tr>',
getItemPropLabel(mfname),
getItemPropFormattedValue(mfname, vt.head, mvt.head),
getItemPropFormattedValue(mfname, vt.body, mvt.body),
getItemPropFormattedValue(mfname, vt.waist, mvt.waist),
getItemPropFormattedValue(mfname, vt.leg, mvt.leg),
pc.head, pc.body, pc.waist, pc.leg,
getItemPropFormattedValue(mfname, vt.avg, mvt.avg),
pc.avg
);
}
}
html += '</table>';
html += '</td></tr>';
html += '</table>';
html += '</td></tr></table>';
html += '</div>';
return html;
}
function onToggleShowImagesOption()
{
dressOptions.showImages = !dressOptions.showImages;
saveOptions();
catlistsources = {};
}
function applyAlphaForMenuAndTipOption()
{
var newMenuOpacity = dressOptions.useAlphaForMenuAndTip ? defaultMenuOpacity : 100;
var newTipOpacity = dressOptions.useAlphaForMenuAndTip ? defaultTipOpacity : 100;
var menu = document.getElementById(menuDivId);
var popup = document.getElementById(popupDivId);
if (is.ie)
{
menu.filters['alpha'].opacity = newMenuOpacity;
popup.filters['alpha'].opacity = newTipOpacity;
}
else
{
menu.style.opacity = (newMenuOpacity / 100);
menu.style.MozOpacity = (newMenuOpacity / 100);
menu.style.KhtmlOpacity = (newMenuOpacity / 100);
popup.style.opacity = (newTipOpacity / 100);
popup.style.MozOpacity = (newTipOpacity / 100);
popup.style.KhtmlOpacity = (newTipOpacity / 100);
}
}
function onToggleUseAlphaForMenuAndTipOption()
{
dressOptions.useAlphaForMenuAndTip = !dressOptions.useAlphaForMenuAndTip;
applyAlphaForMenuAndTipOption();
saveOptions();
}
function onToggleUseTransitionEffectsOption()
{
dressOptions.useTransitionEffects = !dressOptions.useTransitionEffects;
saveOptions();
}
function onToggleCaptureMouseOption()
{
dressOptions.captureMouse = !dressOptions.captureMouse;
saveOptions();
}
function onTogglePreloadImagesOption()
{
dressOptions.preloadImages = !dressOptions.preloadImages;
if (dressOptions.preloadImages)
{
preloadImagesWanted();
}
saveOptions();
}
function onToggleColorizedDummyOption()
{
dressOptions.colorizedDummy = !dressOptions.colorizedDummy;
if (activeState != null)
{
hardUpdateDresserState(activeState);
}
saveOptions();
}
function onOptionsMenu()
{
var menuHtml ='<table width="300px" border="0">';
if (dressOptions.showImages)
{
menuHtml += getRowMenuItemHtml(localizer.optionsHideImages, "onToggleShowImagesOption()");
}
else
{
menuHtml += getRowMenuItemHtml(localizer.optionsShowImages, "onToggleShowImagesOption()");
}
if (dressOptions.useAlphaForMenuAndTip)
{
menuHtml += getRowMenuItemHtml(localizer.optionsDontUseAlphaForMenuAndTip, "onToggleUseAlphaForMenuAndTipOption()");
}
else
{
menuHtml += getRowMenuItemHtml(localizer.optionsUseAlphaForMenuAndTip, "onToggleUseAlphaForMenuAndTipOption()");
}
if (is.ie)
{
if (dressOptions.useTransitionEffects)
{
menuHtml += getRowMenuItemHtml(localizer.optionsDontUseTransitionEffects, "onToggleUseTransitionEffectsOption()");
}
else
{
menuHtml += getRowMenuItemHtml(localizer.optionsUseTransitionEffects, "onToggleUseTransitionEffectsOption()");
}
if (dressOptions.captureMouse)
{
menuHtml += getRowMenuItemHtml(localizer.optionsDontCaptureMouse, "onToggleCaptureMouseOption()");
}
else
{
menuHtml += getRowMenuItemHtml(localizer.optionsCaptureMouse, "onToggleCaptureMouseOption()");
}
}
if (dressOptions.preloadImages)
{
menuHtml += getRowMenuItemHtml(localizer.optionsDontPreloadImages, "onTogglePreloadImagesOption()");
}
else
{
menuHtml += getRowMenuItemHtml(localizer.optionsPreloadImages, "onTogglePreloadImagesOption()");
}
if (dressOptions.colorizedDummy)
{
menuHtml += getRowMenuItemHtml(localizer.optionsColorizedDummyOff, "onToggleColorizedDummyOption()");
}
else
{
menuHtml += getRowMenuItemHtml(localizer.optionsColorizedDummyOn, "onToggleColorizedDummyOption()");
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table>';
showMenu(menuHtml);
}
function onApplyConcreteElix(e, elixn, v)
{
var state = activeState;
if (state == null)
{
return;
}
if (elixn == 'spellIntel')
{
state.spellIntel = v;
}
else if (elixn == 'spellHitpointsUp' || elixn == 'spellHitpointsDown')
{
state.spellHitpoints = v;
}
else if (elixn == 'spellBD')
{
state.spellBD = v;
}
else if (elixn in knownDamageElix)
{
if (v > 0) {
for (var delixn in state.defElixes) {
if (areArraysIntersect(knownDefElix[delixn].places, knownDamageElix[elixn].places)) {
delete state.defElixes[delixn];
}
}
for (var delixn in state.damageElixes) {
if (areArraysIntersect(knownDamageElix[delixn].places, knownDamageElix[elixn].places)) {
delete state.damageElixes[delixn];
}
}
state.damageElixes[elixn] = v;
}
else if (elixn in state.damageElixes)
{
delete state.damageElixes[elixn];
}
}
else if (elixn in knownDefElix)
{
for (var delixn in state.defElixes)
{
if (areArraysIntersect(knownDefElix[delixn].places, knownDefElix[elixn].places))
{
delete state.defElixes[delixn];
}
}
for (var delixn in state.damageElixes) {
if (areArraysIntersect(knownDamageElix[delixn].places, knownDefElix[elixn].places))
{
delete state.damageElixes[delixn];
}
}
if (v > 0)
{
state.defElixes[elixn] = v;
}
}
else
{
if (elixn == null || v <= 0 || knownElix[elixn] == null)
{
state.statElix = null;
}
else
{
var elix = knownElix[elixn] || knownApplicableSpells[elixn];
state.statElix = { elixn: elixn, v: v };
}
}
hardUpdateDresserState(state);
if (e !== null) {
if (!is.ie && e.stopPropagation)
{
e.stopPropagation();
}
if (is.ie)
{
window.event.cancelBubble = true;
window.event.returnValue = false;
}
}
return false;
}
function onConcreteElixMenu(event, elixn)
{
var state = activeState;
var elix = knownElix[elixn] || knownApplicableSpells[elixn] || knownDefElix[elixn];
if (state == null || elix == null)
{
return;
}
var menuHtml ='<table width="320px" border="0"><tr><td>';
if (elix.id.indexOf('{0}') < 0)
{
menuHtml += format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> ', itemImgPath, 'icon_' + elix.id, elix.caption);
menuHtml += elix.caption.bold();
}
else
{
menuHtml += format(elix.caption, '').bold();
}
menuHtml += '</td></tr>';
var captionHead = (('isSpell' in elix) && elix.isSpell) ? localizer.appliedSpell : localizer.statWeakness;
for (var i = 0; i < elix.values.length; i++)
{
var caption = (('isSpell' in elix) && elix.isSpell) ? localizer.dropSpell : localizer.dropElix;
var v = elix.values[i];
var sv = (v > 0) ? ('+' + v.toString()) : v.toString();
if ((elix.check == 1) && (state.natural.level == v))
{ sv=sv.bold();}
if (v != 0)
{
if (elix.id.indexOf('{0}') < 0)
{
caption = captionHead
+ ' '
+ getItemPropLabel(elix.makeUp)
+ sv;
}
else
{
if (elix.check == 1)
{
caption =
format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> ', trickImgPath, elix.pic, elix.caption)
+ ' '
+ captionHead
+ ' '
+ elix.caption
+ sv;
}
else
{
caption =
format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> ', itemImgPath, format(elix.id, Math.abs(v)), (elix.caption + sv))
+ ' '
+ captionHead
+ ' '
+ elix.caption
+ sv
;
}
}
}
menuHtml += getRowMenuItemHtml(caption, format("onApplyConcreteElix(event, '{0}', {1})", elixn, v));
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table>';
showMenu(menuHtml);
if (event !== null) {
if (!is.ie && event.stopPropagation)
{
event.stopPropagation();
}
if (is.ie)
{
window.event.cancelBubble = true;
window.event.returnValue = false;
}
}
return false;
}
function onSwitchConcreteElix(e, elixn)
{
var state = activeState;
if (state == null)
{
return;
}
var putOn = (elixn in state.damageElixes) ? 0 : 1;
onApplyConcreteElix(e, elixn, putOn);
}
function onElixMenu()
{
//cursorX -= 240;
if ('onElixMenu' in menuhash)
{
showMenu(menuhash.onElixMenu);
return;
}
var state = activeState;
if (state == null)
{
return;
}
//var menuHtml = '<table width="640" border="0"><tr><td>';
var menuHtml = '<table width="640" border="0"><tr><td>';
menuHtml += '<table width="320" border="0">';
menuHtml += getRowMenuItemHtml(localizer.noElix, "onApplyConcreteElix(event, null, 0)");
menuHtml += getRowMenuSeparatorHtml();
for (var elixn in knownElix)
{
var elix = knownElix[elixn];
if (elix == null)
{
menuHtml += getRowMenuSeparatorHtml();
continue;
}
var caption = elix.caption;
caption = format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> ', itemImgPath, 'icon_' + elix.id, elix.caption) + caption;
menuHtml += getRowMenuItemHtml(caption, format("onConcreteElixMenu(event, '{0}')", elixn));
}
menuHtml += '</table></td><td><table width="320" border="0">';
for (var elixn in knownDamageElix)
{
var elix = knownDamageElix[elixn];
if (elix == null)
{
menuHtml += getRowMenuSeparatorHtml();
continue;
}
var caption = format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> ', itemImgPath, 'icon_' + elix.id, elix.caption) + elix.caption;
var action = format("onSwitchConcreteElix(event, '{0}')", elixn);
menuHtml += getRowMenuItemHtml(caption, action);
}
menuHtml += getRowMenuSeparatorHtml();
var a=0;
for (var elixn in knownDefElix)
{
a++;
if (a<9)
{
var elix = knownDefElix[elixn];
if (elix == null)
{
menuHtml += getRowMenuSeparatorHtml();
continue;
}
var caption = elix.caption;
caption = format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> ', itemImgPath, 'icon_' + elix.id, elix.caption) + caption;
menuHtml += getRowMenuItemHtml(caption, format("onConcreteElixMenu(event, '{0}')", elixn));
}
}
/*menuHtml += '</table></td><td><table width="240" border="0">';
var a=0;
for (var elixn in knownDefElix)
{
a++;
if (a>=9)
{
var elix = knownDefElix[elixn];
if (elix == null)
{
menuHtml += getRowMenuSeparatorHtml();
continue;
}
var caption = elix.caption;
caption = format('<img src="{0}{1}.gif" width="15" height="15" alt="{2}" border="0" /> ', itemImgPath, elix.id, elix.caption) + caption;
menuHtml += getRowMenuItemHtml(caption, format("onConcreteElixMenu(event, '{0}')", elixn));
}
}
menuHtml += '</table></td></tr><tr><td colspan="3"><table width="640" border="0">';
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table></td></tr></table>';*/
menuHtml += '</table></td></tr><tr><td colspan="2"><table width="640" border="0">';
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table></td></tr></table>';
menuhash.onElixMenu = menuHtml;
showMenu(menuHtml);
}
function onApplyWAdd(e, waddn)
{
var state = activeState;
if (state == null)
{
return;
}
state.objects[slot_wadd.index] = null;
state.fitSlots[slot_wadd.index] = null;
state.upgradeSlots[slot_wadd.index] = null;
state.charmSlots[slot_wadd.index] = null;
state.addSlots[slot_wadd.index] = null;
state.runeSlots[slot_wadd.index] = null;
state.objCache[slot_wadd.index] = null;
state.objects[slot_wadd.index] = waddn;
updateDresserState();
if (e !== null) {
if (!is.ie && e.stopPropagation)
{
e.stopPropagation();
}
if (is.ie)
{
window.event.cancelBubble = true;
window.event.returnValue = false;
}
}
return false;
}
function onWAddMenu()
{
var state = activeState;
if (state == null)
{
return;
}
var menuHtml = '';
menuHtml += '<table width="240" border="0">';
if (state.objects[slot_wadd.index] != null)
{
menuHtml += getRowMenuItemHtml(localizer.noWAdd, 'onApplyWAdd(event, null)');
menuHtml += getRowMenuSeparatorHtml();
}
for (var waddn in knownAdds)
{
if (state.objects[slot_wadd.index] == waddn)
{
continue;
}
var wadd = knownAdds[waddn];
var caption = wadd.caption;
caption = format('<img src="{0}{1}.gif" width="15" height="15" alt="{2}" border="0" /> ', itemImgPath, wadd.id, wadd.caption) + caption;
menuHtml += getRowMenuItemHtml(caption, format("onApplyWAdd(event, '{0}')", waddn));
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table>';
showMenu(menuHtml);
}
function onApplyBuffTemplate(e, template) {
var state = activeState;
if (state == null) {
return;
}
state.spellPowerUps = {};
state.spellIntel = 0;
state.spellHitpoints = 0;
state.pet = null;
state.defElixes = {};
state.damageElixes = {};
let level = state.natural.level,
statElixType = (level >= 10) ? 3 : ((level >= 8) ? 2 : ''),
statElixPower = (level >= 10) ? 30 : ((level >= 8) ? 22 : 15),
defenceElixType = (level >= 10) ? 'pot_base_300_alldmg' : ((level >= 8) ? 'pot_base_200_allmag2_p1k' : 'pot_base_200_allmag3'),
magicdefenceElixType = (level >= 10) ? 'pot_base_300_allmag' : ((level >= 8) ? 'pot_base_200_alldmg2_p1k' : 'pot_base_200_alldmg3'),
defenceElixPower = (level >= 10) ? 212 : ((level >= 8) ? 150 : 125);
onApplyConcreteElix(null, defenceElixType, defenceElixPower); // от урона
onApplyConcreteElix(null, magicdefenceElixType, defenceElixPower); // магии
onApplyConcreteElix(null, 'spellHitpointsUp', 6); // жажда жизни
onPowerUp(null, 'spell_protect1'); // защиты от магий
onPowerUp(null, 'spell_protect2');
onPowerUp(null, 'spell_protect3');
onPowerUp(null, 'spell_protect4');
if (level >= 8) {
onECRPowerUp(null, 'defender'); // знак защитника клуба
onECRPowerUp(null, 'standart_curse'); // баф кат
onECRPowerUp(null, 'spell_godprotect10'); // неуязы
onECRPowerUp(null, 'spell_godprotect');
onSwitchConcreteElix(null, 'pot_base_100_master'); // мастера
}
onPowerUp(null, 'spell_protect10');
switch (template) {
case 1:
onPowerUp(null, 'spell_powerup10');
summonPet('demon', Math.min(level, 10));
onApplyConcreteElix(null, 'strength' + statElixType, statElixPower);
onApplyWAdd(event, 'food_l11_e');
if (level >= 8) {
onECRPowerUp(null, 'gg_gribnica_reward');
}
if (level >= 10) {
onECRPowerUp(event, 'gl_npc_skeleton_buff1');
}
break;
case 2:
onPowerUp(null, 'spell_powerup10');
summonPet('cat', Math.min(level, 10));
onApplyConcreteElix(null, 'dexterity' + statElixType, statElixPower);
onApplyWAdd(event, 'food_l11_e');
if (level >= 8) {
onECRPowerUp(null, 'gg_gribnica_reward');
}
if (level >= 10) {
onECRPowerUp(event, 'gl_npc_ghost_buff1');
}
break;
case 3:
onPowerUp(null, 'spell_powerup10');
summonPet('owl', Math.min(level, 10));
onApplyConcreteElix(null, 'intuition' + statElixType, statElixPower);
onApplyWAdd(event, 'food_l11_e');
if (level >= 8) {
onECRPowerUp(null, 'gg_gribnica_reward');
}
if (level >= 10) {
onECRPowerUp(event, 'gl_npc_ghost_buff2');
}
break;
case 4:
onApplyConcreteElix(null, 'spellIntel', 10);
onPowerUp(null, 'spell_powerup1');
onPowerUp(null, 'spell_powerup2');
onPowerUp(null, 'spell_powerup3');
onPowerUp(null, 'spell_powerup4');
summonPet('wisp', Math.min(level, 10))
onApplyConcreteElix(null, 'intellect' + statElixType, statElixPower);
onApplyWAdd(null, 'food_l10_e');
if (level >= 8) {
onECRPowerUp(null, 'gg_macropus_reward');
}
if (level >= 10) {
onECRPowerUp(event, 'gl_npc_skeleton_buff2');
}
break;
default:
break;
}
if (e !== null) {
if (!is.ie && e.stopPropagation)
{
e.stopPropagation();
}
if (is.ie)
{
window.event.cancelBubble = true;
window.event.returnValue = false;
}
}
return false;
}
function onBuffTemplateMenu() {
var state = activeState;
if (state == null) {
return;
}
var menuHtml = '';
menuHtml += '<table width="240" border="0">';
menuHtml += getRowMenuItemHtml('Силовик (свирепость)', 'onApplyBuffTemplate(event, 1)');
menuHtml += getRowMenuItemHtml('Уворот (грация)', 'onApplyBuffTemplate(event, 2)');
menuHtml += getRowMenuItemHtml('Крит (неукротимость)', 'onApplyBuffTemplate(event, 3)');
menuHtml += getRowMenuItemHtml('Маг (просветление)', 'onApplyBuffTemplate(event, 4)');
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table>';
showMenu(menuHtml);
}
function onPowerUp(e, spellid)
{
var state = activeState;
if (state == null)
{
return;
}
var maxv = 33;
var del = false;
var spell = knownPowerUps[spellid];
if (spell != null && !spell.damageup)
{
maxv = 125;
}
var v = maxv;
if (spellid in state.spellPowerUps)
{
v = state.spellPowerUps[spellid];
}
v = spell.value;
v = parseInt(v);
if (spellid in state.spellPowerUps)
{
v = 0 ;
}
if (isNaN(v))
{
return;
}
if (v < 0)
{
v = 0;
}
if (v > maxv)
{
v = maxv;
}
if (v > 0)
{
state.spellPowerUps[spellid] = v;
}
else
{
delete state.spellPowerUps[spellid];
}
updateDresserStateWanted();
if (e != null) {
if (!is.ie && e.stopPropagation) {
e.stopPropagation();
}
if (is.ie) {
window.event.cancelBubble = true;
window.event.returnValue = false;
}
}
return false;
}
function onECRPowerUp(e, spellid)
{
var state = activeState;
if (state == null)
{
return;
}
if (spellid in state.spellPowerUps)
{
delete state.spellPowerUps[spellid];
}
else
{
for (let existingSpellId in state.spellPowerUps) {
if (existingSpellId in knownECRPowerUps && areArraysIntersect(knownECRPowerUps[existingSpellId].places, knownECRPowerUps[spellid].places)) {
delete state.spellPowerUps[existingSpellId];
}
}
state.spellPowerUps[spellid] = knownECRPowerUps[spellid].v;
}
updateDresserStateWanted();
if (e !== null) {
if (!is.ie && e.stopPropagation) {
e.stopPropagation();
}
if (is.ie) {
window.event.cancelBubble = true;
window.event.returnValue = false;
}
}
return false;
}
function onSpellMenu()
{
//cursorX -= 100;
if ('onSpellMenu' in menuhash)
{
showMenu(menuhash.onSpellMenu);
return;
}
var state = activeState;
if (state == null)
{
return;
}
var menuHtml = '<table width="640px" border="0">';
menuHtml += '<tr><td valign="top"><table width="320px" border="0">';
for (var spelln in knownApplicableSpells)
{
var spell = knownApplicableSpells[spelln];
if (spell == null)
{
menuHtml += getRowMenuSeparatorHtml();
continue;
}
var spellHtml = spell.caption;
if (spell.check == 1)
{
spellHtml = format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> {2}', trickImgPath, spell.id, spell.caption);
}else if (spell.id.indexOf('(0}') < 0)
{
spellHtml = format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> {2}', itemImgPath, format(spell.id, 5), spell.caption);
}
menuHtml += getRowMenuItemHtml(spellHtml, format("onConcreteElixMenu(event, '{0}')", spelln));
}
menuHtml += getRowMenuSeparatorHtml();
for (var powerupn in knownPowerUps)
{
var o = getObjectById(powerupn);
var caption = format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> {3}', itemImgPath, o.id, o.caption, htmlstring(o.caption));
menuHtml += getRowMenuItemHtml(caption, format("onPowerUp(event, '{0}')", powerupn));
}
menuHtml += getRowMenuSeparatorHtml();
for (var powerupn in knownAdds)
{
var o = getObjectById(powerupn);
var caption = format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> {3}', itemImgPath, o.id, o.caption, htmlstring(o.caption));
menuHtml += getRowMenuItemHtml(caption, format("onApplyWAdd(event, '{0}')", powerupn));
}
menuHtml += '</table></td><td valign="top"><table width="320px" border="0">';
for (var powerupn in knownECRPowerUps)
{
var o = getObjectById(powerupn);
var caption = format('<img src="{0}{1}.gif" width="32" height="20" alt="{2}" border="0" /> {3}', itemImgPath, o.id, o.caption, htmlstring(o.caption));
menuHtml += getRowMenuItemHtml(caption, format("onECRPowerUp(event, '{0}')", powerupn));
}
menuHtml += '</table></td></tr><tr><td colspan="2" valign="top"><table width="640px" border="0">';
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table></td></tr></table>';
menuhash.onSpellMenu = menuHtml;
showMenu(menuHtml);
}
function summonPet(petn, level)
{
var state = activeState;
if (state == null)
{
return;
}
if (petn == null)
{
state.pet = null;
hardUpdateDresserState(state);
return;
}
var pet = pets[petn];
if (level <= state.natural.level)
{
state.pet = { n: petn, name: pet.caption, level: level };
}
else
{
state.pet = { n: petn, name: pet.caption, level: state.natural.level };
}
hardUpdateDresserState(state);
}
function onConcretePetMenu(petn)
{
var state = activeState;
if (state == null)
{
return;
}
var pet = pets[petn];
var menuHtml ='<table width="240px" border="0">';
menuHtml += format('<img src="{2}{1}.gif" width="32" height="20" border="0" alt="{0}" /> {0}', pet.caption, pet.summon.name, itemImgPath);
if (state.pet != null)
{
menuHtml += getRowMenuItemHtml(localizer.dropPet, 'summonPet()');
menuHtml += getRowMenuSeparatorHtml();
}
// see here
for (var leveln in pet.levels)
{
var level = pet.levels[leveln];
if (level.level <= state.natural.level)
{
var text = format('[{0}] Уровень', level.level);
menuHtml += getRowMenuItemHtml(text, format("summonPet('{0}', {1})", petn, level.level));
}
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table>';
showMenu(menuHtml);
}
function onPetMenu()
{
var state = activeState;
if (state == null)
{
return;
}
var menuHtml ='<table width="240px" border="0">';
if (state.pet != null)
{
menuHtml += getRowMenuItemHtml(localizer.dropPet, 'summonPet()');
menuHtml += getRowMenuSeparatorHtml();
}
for (var petn in pets)
{
var pet = pets[petn];
var petHtml = format('<img src="{2}{1}.gif" width="40" height="25" border="0" alt="{0}" /> {0}', pet.caption, pet.summon.name, itemImgPath);
menuHtml += getRowMenuItemHtml(petHtml, format("onConcretePetMenu('{0}')", petn));
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table>';
showMenu(menuHtml);
}
function loadFriendLinks()
{
var qs = window.location.search;
if (qs == null || qs.length < 4)
{
return;
}
var params = qs.match("[^\?=&]*=[^\?=&]*");
for (var i = 0; i < params.length; i++)
{
var paramName = params[i];
var paramValue = '';
if (paramName.indexOf('=') >= 0)
{
var sp = paramName.split('=');
paramName = sp[0];
paramValue = unescape(sp[1]);
}
if (paramName == 'data')
{
var newState = deserializeObject(paramValue);
if (newState != null)
{
applyDeserializedState(null, newState);
}
}
if (paramName == 'raw')
{
var newState = createNewDresserState();
updateTabs(false);
recalcDresserState(newState);
updateCabs();
changeCab(newState.id);
someStatesLoaded = true;
handleCharInfo(newState, paramValue);
}
}
}
function onFriendLink(stateid)
{
var state = dressStates[stateid];
if (state == null)
{
return;
}
var menuHtml ='<table border="0"><tr><td>';
var url = absoluteDressRoomUrl
url += '?data=';
url += escape(serializeObject(getSerializableState(state)));
menuHtml += format(localizer.friendLinkHint, clanImgPath);
menuHtml += '<br /><textarea id="friendLink" class="inpText" cols="50" rows="8" wrap="VIRTUAL" readonly="true">';
menuHtml += url;
menuHtml += '</textarea></td></tr>';
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table>';
showMenu(menuHtml, false);
var telt = document.getElementById('friendLink');
if (telt != null)
{
telt.focus();
telt.select();
}
}
function updateEnduranceLimit(level, up)
{
var end = 0, spirituality_limit = 0;
for (var i = 0; i <= level; i++)
{
var leveln = 'L' + i;
if (!(leveln in expd))
{
break;
}
var ld = expd[leveln];
if (!('U0' in ld.ups))
{
break;
}
var ups = (i == level) ? ((('U' + up) in expd[leveln].ups) ? (up + 1) : Object.keys(expd[leveln].ups).length) : Object.keys(expd[leveln].ups).length;
for (var j = 0; j < ups; j++) {
let key = 'U' + j, nextup = ld.ups[key];
end += nextup.aendurance;
spirituality_limit += nextup.aspirituality;
}
// end += ld.ups.U0.aendurance;
}
knownStatLimits.endurance = end;
knownStatLimits.spirituality = spirituality_limit;
}
function onFitStats(stateid)
{
var state = dressStates[stateid];
if (state == null)
{
return;
}
updateEnduranceLimit(state.natural.level, state.natural.levelup);
for (var name in state.required)
{
var newnv = state.required[name];
if (name in state.modify)
{
newnv -= state.modify[name];
}
if (name in state.battlemf)
{
newnv += state.battlemf[name];
}
if (newnv < 0)
{
newnv = 0;
}
if (name in knownStatLimits)
{
if (newnv < knownStatLimits[name])
{
newnv = knownStatLimits[name];
}
}
if (name.indexOf('skill') > 0)
{
if (name.indexOf('magicskill') > 0)
{
if (newnv > 10)
{
newnv = 10;
}
}
else
{
if (newnv > 5)
{
newnv = 5;
}
}
}
if (!(name in state.natural) || (state.natural[name] < newnv))
{
state.natural[name] = newnv;
}
}
updateDresserState(state);
}
function handleCharInfo(state, text)
{
var stateid = state.id;
var objects = [];
var doneState = {};
// Combats VIP bug wrapping
text = replacestr(text, shortVip, shortVip + "\n");
var pet_type = '';
var pet_level = 0;
var pet_name = '';
var align = '0';
var clan = '';
var sex = 0;
var img = 0;
var zodiac = '';
var propDefs = text.split("\n");
var rstats = {};
for (var propi = 0; propi < propDefs.length; propi++)
{
var propDef = propDefs[propi];
var propName = propDef;
var propVal = '';
var eqi = propDef.indexOf('=');
if (eqi > 0)
{
propName = propDef.substr(0, eqi);
propVal = propDef.substr(eqi + 1);
}
if (propName in shortInfoMap)
{
doneState[shortInfoMap[propName]] = parseInt(propVal);
continue;
}
if (propName in shortInfoMap2)
{
rstats[shortInfoMap2[propName]] = parseInt(propVal);
continue;
}
if (propName == 'login')
{
nick = propVal;
continue;
}
if (propName == 'align')
{
align = propVal;
continue;
}
if (propName == 'klan')
{
clan = propVal;
continue;
}
if (propName == 'sex')
{
sex = parseInt(propVal);
continue;
}
if (propName == 'img')
{
img = propVal;
continue;
}
if (propName == 'zodiac')
{
zodiac = propVal;
continue;
}
if (propName == 'objects')
{
objects = propVal.split(',');
continue;
}
if (propName == 'pet_type')
{
pet_type = propVal;
continue;
}
if (propName == 'pet_level')
{
pet_level = propVal;
continue;
}
if (propName == 'pet_name')
{
pet_name = propVal;
continue;
}
if (propName == 'found')
{
if (parseInt(propVal) === 0)
{
alert('Персонаж с такими ником не найден');
return;
}
}
}
var state = createNewDresserState(state.id);
state.name = nick;
state.align = align;
state.clan = clan;
state.sign = zodiac;
state.sex = sex;
state.image = img;
if ((pet_type != '') && (pet_type in pets))
{
var pet = pets[pet_type];
if (('L' + pet_level) in pet.levels)
{
state.pet = { n: pet_type, name: pet_name, level: pet_level };
}
}
if ('level' in doneState)
{
state.natural.level = doneState.level;
}
for (var oi = 0; oi < objects.length; oi++)
{
var oname = objects[oi];
var oval = '';
var eqi = oname.indexOf('=');
if (eqi >= 0)
{
oval = oname.substr(eqi + 1);
oname = oname.substr(0, eqi);
}
if (oname == '')
{
continue;
}
oval = oval.split('\\n');
applyAssortedObject(state, oname, oval);
}
recalcDresserState(state);
for (var stat in doneState)
{
state.natural[stat] = doneState[stat] - state.modify[stat];
if (stat in state.battlemf)
{
state.natural[stat] += state.battlemf[stat];
}
}
for (var stat in rstats)
{
state.natural[stat] = rstats[stat];
}
activeState = state;
hardUpdateDresserState(state);
// changeCab(state.id);
}
function onDressFromCombatsNick(stateid)
{
var state = dressStates[stateid];
if (state == null)
{
return;
}
var nick = document.getElementById('dfcnick').value;
var text = '';
if (dressOptions.benderOmskMode)
{
window.navigate(format(benderOmsk.getInfoLink, nick));
return;
}
if (dressOptions.hasGetDSCharInfo)
{
var dstatestr = window.external.getDSCharInfo(nick);
if (dstatestr == null)
{
return;
}
applyDeserializedState(stateid, deserializeObject(dstatestr));
return;
}
if (dressOptions.hasGetCharInfo)
{
text = window.external.getCharInfo(nick);
if (text == null)
{
text = 'found=0';
}
}
else
{
//nick = urlesc(nick);
var url = format(getCharacterInfoUrlFormat, nick);
//if (!loadXMLDoc(url))
//{
return;
//}
text = req.responseText;
}
handleCharInfo(state, text);
}
function onDressFromCombatsMenu(stateid)
{
var state = dressStates[stateid];
if (state == null)
{
return;
}
var menuHtml ='<table width="260px" border="0"><tr><td><img src="' + clanImgPath + 'DarkClan.gif" width="24" height="15" border="0" align="right" /><b>Загрузка манекена с персонажа БК</b><form name="dfc" method="GET" onreset="hideMenu()" onsubmit="return false"><center>';
menuHtml += localizer.FCPlayerNick + ': <input id="dfcnick" name="dfcnick" type="text" value="';
menuHtml += state.name;
menuHtml += '" class="ABText80" />';
menuHtml += '<hr class="dashed" />';
menuHtml += '<input class="inpButton" type="submit" name="Submit" value="' + localizer.FCPlayerLoadIn + '" onclick="onDressFromCombatsNick(' + format("'{0}'", state.id) + '); hideMenu(); return false" /> <input name="cancel" class="inpButton" type="reset" id="cancel" value="' + localizer.cancel + '" onclick="hideMenu()" />';
menuHtml += '<hr class="dashed" />';
menuHtml += localizer.informAboutCharLoading;
menuHtml += '</center></form></td></tr></table>';
showMenu(menuHtml, false);
document.getElementById('dfcnick').focus();
}
function onCopyCab(stateid)
{
var state = dressStates[stateid];
if (state == null)
{
return;
}
var serstate = getSerializableState(state);
applyDeserializedState(null, serstate);
}
function getDresserCommands(state)
{
var html = '<table cellpadding="0" cellspacing="0" border="0"><tr>';
//html += '<img src="http://upload.wikimedia.org/wikipedia/commons/e/e5/Crystal_Clear_app_x.png" width="32" height="32">'
html += getCell2MenuItemHtml(localizer.dropAll, 'onDropAll()');
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml(localizer.clearAllStats, format("onClearAllStats('{0}')", state.id));
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml(localizer.fitStats, format("onFitStats('{0}')", state.id));
html += getCell2MenuSeparatorHtml();
html += '</tr></table><table cellpadding="0" cellspacing="0" border="0"><tr>';
html += getCell2MenuItemHtml(localizer.saveSet, format("onSaveSet('{0}')", state.id));
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml(localizer.loadSet, format("onLoadSet('{0}')", state.id));
html += getCell2MenuSeparatorHtml();
var s = localizer.dressFromCombats;
html += getCell2MenuItemHtml(localizer.dressCombatsSet, 'onDressAnyCombatsSet()');
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml(localizer.copyCab, format("onCopyCab('{0}')", state.id));
html += getCell2MenuSeparatorHtml();
html += '</tr></table><table cellpadding="0" cellspacing="0" border="0"><tr>';
html += getCell2MenuItemHtml('Шаблоны обкаста', 'onBuffTemplateMenu()');
/* html += getCell2MenuItemHtml(localizer.waddMenu, 'onWAddMenu()');
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml(localizer.spellMenu, 'onSpellMenu()');
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml(localizer.petMenu, 'onPetMenu()');
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml(localizer.elixMenu, 'onElixMenu()');
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml(localizer.optionsMenu, "onOptionsMenu()");
html += '</tr></table><table cellpadding="0" cellspacing="0" border="0"><tr>';
s = '<img unselectable="on" src="' + hereItemImgPath + 'dressFromCombats.gif" width="17" height="15" border="0" /><font unselectable="on" color="#003300" title="' + localizer.dressFromCombatsHint + '">' + s + '</font>';
html += getCell2MenuItemHtml(s, format("onDressFromCombatsMenu('{0}')", state.id));
html += getCell2MenuItemHtml('<img unselectable="on" src="' + hereItemImgPath + 'dressFriendLink.gif" width="16" height="15" border="0" /><font unselectable="on" color="#330033">' + localizer.friendLink + '</font>', format("onFriendLink('{0}')", state.id));
html += getCell2MenuSeparatorHtml();
html += '</tr></table><table cellpadding="0" cellspacing="0" border="0"><tr>';
html += getCell2MenuItemHtml('<span title="' + localizer.doCleanHint + '">' + localizer.doClean + '</span>', "doClean()");
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml('<img unselectable="on" src="' + hereItemImgPath + 'dressHelp.gif" width="17" height="15" border="0" /><font unselectable="on" color="#000033" title="' + localizer.helpHint + '">' + localizer.help + '</font>', "showHelp()");*/
html += '</tr></table>';
return html;
}
function getDresserNaturalEditorInfo(state, name)
{
var html = '';
if (name in state.results)
{
var vt = state.results[name];
var vr = (name in state.required) ? state.required[name] : 0;
var vn = (name in state.natural) ? state.natural[name] : 0;
var vm = (name in state.modify) ? state.modify[name] : 0;
var vb = (name in state.battlemf) ? state.battlemf[name] : 0;
vt -= vb;
vm -= vb;
var mvt = vt;
for (var staten in dressStates)
{
var astate = dressStates[staten];
var avn = (name in astate.natural) ? astate.natural[name] : 0;
var avm = (name in astate.modify) ? astate.modify[name] : 0;
var avt = (name in astate.results) ? astate.results[name] : 0;
if (name in astate.battlemf)
{
avt -= astate.battlemf[name];
avm -= astate.battlemf[name];
}
if (mvt < avt)
{
mvt = avt;
}
}
html += getItemPropTNMRBHtml(name, vt, vn, vm, mvt, vr, true, vb);
}
return html;
}
function getLevelUpInfo(state)
{
if (('L' + state.natural.level) in expd)
{
var ldata = expd['L' + state.natural.level];
if (!('ups' in ldata) || !(('U' + state.natural.levelup) in ldata.ups))
{
if ('count' in ldata)
{
state.natural.levelup = ldata.count - 1;
}
else
{
state.natural.levelup = 0;
}
}
if (!('ups' in ldata) || !('U0' in ldata.ups))
{
return null;
}
return ldata.ups['U' + state.natural.levelup];
}
return null;
}
function getEditHeaderInfo(state)
{
var html = '';
var totalnskills = 0;
for (skilln in state.natural)
{
if (skilln.indexOf('skill') > 0)
{
totalnskills += state.natural[skilln];
}
}
if (state.pet != null)
{
if (state.pet.level > state.natural.level)
{
html += '<div class="hintview">';
html += format(localizer.badPetLevel, state.natural.level, state.pet.level);
html += '</div>';
}
}
var availskills = state.natural.pskil;
for (var i = 0; i <= state.natural.level; i++) {
var leveln = 'L' + i;
if (!(leveln in expd)) {
break;
}
var ld = expd[leveln];
if (!('U0' in ld.ups)) {
break;
}
var ups = (i == state.natural.level) ? ((('U' + state.natural.levelup) in expd[leveln].ups) ? (state.natural.levelup + 1) : Object.keys(expd[leveln].ups).length) : Object.keys(expd[leveln].ups).length;
for (var j = 0; j < ups; j++) {
let key = 'U' + j, nextup = ld.ups[key];
availskills += nextup.amastery;
}
}
if (availskills < totalnskills)
{
var pskilstr = '';
if (state.natural.pskil > 0)
{
pskilstr = format(localizer.badSkillRewardedCount, state.natural.pskil);
}
html += '<div class="hintview">';
html += format(localizer.badSkillCount, state.natural.level, pskilstr, availskills, totalnskills, state.natural.levelup);
html += '</div>';
}
if (state.natural.pskil > 7)
{
html += '<div class="hintview">';
html += format(localizer.badRewardedSkillCount, state.natural.pskil);
html += '</div>';
}
if (state.natural.pstat > 35)
{
html += '<div class="hintview">';
html += format(localizer.badRewardedStatCount, state.natural.pstat);
html += '</div>';
}
var upd = getLevelUpInfo(state);
if (upd && upd.sstats && state.natural.totalstats)
{
html += '<div class="hintview">';
var availstats = upd.sstats + state.natural.pstat;
var s = availstats.toString();
if (state.natural.totalstats != availstats)
{
s = s.bold();
}
var pstatstr = '';
if (state.natural.pstat > 0)
{
pstatstr = format(localizer.rewardedStatsCount, state.natural.pstat);
}
html += format(localizer.nativeStatsCount, state.natural.level, upd.id, pstatstr, s);
if (state.natural.totalstats != availstats)
{
s = state.natural.totalstats.toString();
if (state.natural.totalstats > availstats)
{
s = s.fontcolor('red');
}
html += format(localizer.neqStatsCount, s);
if (state.natural.totalstats < availstats)
{
html += format(localizer.gtStatsCount, (availstats - state.natural.totalstats));
}
else
{
html += format(localizer.ltStatsCount, (state.natural.totalstats - availstats));
}
}
else
{
html += localizer.eqStatsCount;
}
html += '</div>';
}
return html;
}
function getDresserNaturalEditors(state)
{
var html = '<table class="tcontent" width="100%" cellspacing="0" border="0" style="padding: 2px 4px 0px 0px">';
html += format('<tr><td id="{1}{0}" colspan="3">{2}</td></tr>', state.id, 'editheader', getEditHeaderInfo(state));
for (var i = 0; i < knownNaturalEditors.length; i++)
{
var name = knownNaturalEditors[i];
if (name == '-')
{
html += '<tr><td colspan="3"><hr class="dashed" /></td></tr>';
continue;
}
if (!item_props[name].view)
{
continue;
}
html += '<tr><td align="right" valign="top">';
html += format(
'<input name="edit{0}" type="text" id="edit{0}" class="ABTextR" value="{1}" size="3" maxlength="3" onblur="onChangeEdit({2})" />',
state.id + name,
state.natural[name] ? state.natural[name] : 0,
format("this, '{0}', '{1}'", state.id, name)
);
html += '</td><td align="left" valign="top">';
html += getItemPropLabel(name);
html += format('</td><td id="editi{0}{1}" valign="top">', state.id, name);
html += getDresserNaturalEditorInfo(state, name);
html += '</td>';
html += '<td>';
var fiop = 'edit'+state.id+name;
html += '<a onclick="adm(\''+fiop+'\')" href="javascript:;"><img src="images/minus.gif" alt="уменшить" border=0> </a></td>';
html += '<td><a onclick="adp(\''+fiop+'\')" href="javascript:;"><img src="images/plus.gif" alt="увеличить" border=0> </a>';
html += '</td>';
html += '</tr>';
}
html += '</table>';
return html;
}
function adp(formt)
{
document.getElementById(formt).focus();
elem = document.getElementById(formt);
elem.value ++;
document.getElementById(formt).blur();
}
function adm(formt)
{
document.getElementById(formt).focus();
elem = document.getElementById(formt);
elem.value --;
document.getElementById(formt).blur();
}
function updateDresserNaturalEditors(state)
{
var eheader = document.getElementById('editheader' + state.id);
if (eheader == null)
{
document.getElementById('editpane' + state.id).innerHTML = getDresserNaturalEditors(state);
return;
}
eheader.innerHTML = getEditHeaderInfo(state);
for (var i = 0; i < knownNaturalEditors.length; i++)
{
var name = knownNaturalEditors[i];
if (name == '-')
{
continue;
}
var eltname = format('edit{0}{1}', state.id, name);
var elt = document.getElementById(eltname);
if (elt == null)
{
document.getElementById('editpane' + state.id).innerHTML = getDresserNaturalEditors(state);
return;
}
var v = '0';
if (name in state.natural)
{
v = state.natural[name].toString();
}
elt.value = v;
var infname = format('editi{0}{1}', state.id, name);
var inf = document.getElementById(infname);
if (inf == null)
{
document.getElementById('editpane' + state.id).innerHTML = getDresserNaturalEditors(state);
return;
}
inf.innerHTML = getDresserNaturalEditorInfo(state, name);
}
}
function onChangeEdit(field, stateId, propName)
{
var state = dressStates[stateId];
if (state == null)
{
return;
}
var v = parseInt(field.value);
if (isNaN(v) || v < 0)
{
updateDresserState(state);
return;
}
if (propName.lastIndexOf('skill') > 0)
{
if (propName.lastIndexOf('magicskill') > 0)
{
if (v > 10)
{
v = 10;
}
}
else
{
if (v > 5)
{
v = 5;
}
}
}
if (propName == 'level') {
if (v > 12) v = 12;
}
if (propName == 'levelup')
{
if (('L' + state.natural.level) in expd)
{
var ldata = expd['L' + state.natural.level];
if (('ups' in ldata) && (('U' + v) in ldata.ups))
{
var udata = ldata.ups['U' + v];
}
else
{
if ('count' in ldata)
{
v = ldata.count - 1;
}
else
{
v = 0;
}
}
}
}
state.natural[propName] = v;
updateEnduranceLimit(state.natural.level, state.natural.levelup);
for (propName in knownStatLimits)
{
if (!(propName in state.natural) || (state.natural[propName] < knownStatLimits[propName]))
{
state.natural[propName] = knownStatLimits[propName];
}
}
updateDresserState(state);
}
function getDresserShortcuts(state)
{
var html = '';
var btn = '<img src="' + blankImgPath + '" border="0" width="80" height="51" />';
html += '<a class="elixmenu" href="#" onclick="hideMenu(); onElixMenu(); return false" title="' + localizer.elixMenu + '">' + btn + '</a>';
html += '<a class="spellmenu" href="#" onclick="hideMenu(); onSpellMenu(); return false" title="' + localizer.spellMenu + '">' + btn + '</a>';
html += '<a class="petmenu" href="#" onclick="hideMenu(); onPetMenu(); return false" title="' + localizer.petMenu2 + '">' + btn + '</a>';
html += '<hr class="dashed" />';
html += '<a class="dressset" href="#" onclick="hideMenu(); onDressAnyCombatsSet(); return false" title="' + localizer.dressCombatsSet + '">' + btn + '</a>';
html += '<a class="dropitems" href="#" onclick="hideMenu(); onDropAll(); return false" title="' + localizer.dropAll + '">' + btn + '</a>';
html += btn;
return html;
}
function getDresserInnerHtml(state, placeholdersOnly)
{
var fmt = '<table class="tcontent" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top" colspan="2">{3}</td></tr><tr><td valign="top" width="400"><table border="0" cellspacing="0" cellpadding="0" width="400"><tr><td width="320" valign="top">{0}</td><td width="80">{5}</td></tr><tr><td colspan="2" valign="top"><div id="editpane{2}">{4}</div></td></tr></table></td><td valign="top"><div id="infopane{2}">{1}</div></td></tr></table>';
return format(
fmt,
getPersImageHtml(state),
getDresserInfoPaneHtml(state),
state.id,
getDresserCommands(state),
getDresserNaturalEditors(state),
getDresserShortcuts(state)
);
}
function getCellHtml(s, odd)
{
var r = '';
r += '<td ';
if (odd)
{
r += 'class="infolighttd" ';
}
r += '>' + s + '</td>';
return r;
}
function getHeaderHtml(separator)
{
var cattr = separator ? ' class="infoseparator"' : '';
var html = '<tr><th colspan="2"' + cattr + '>';
if (separator)
{
html += '<hr class="dashed" />';
}
else
{
html += ' ';
}
html += '</th>';
var stateCount = 0;
var i = 1;
for (var staten in dressStates)
{
var state = dressStates[staten];
var n = ' ' + localizer.upperCab + ' ' + i + ' ';
if (state.name != '')
{
n += '<br />' + htmlstring(state.name);
}
html += '<th' + cattr + '><nobr>' + n + '</nobr></th>';
stateCount++;
i++;
}
html += '</tr>';
return html;
}
function getLeftCellHtml(s, odd, s2)
{
var c = 'infoleftth';
var r = '<tr><th class="' + c + '" ';
if (s2 == null)
{
r += 'colspan="2">' + s;
}
else
{
r += '>' + s + '</th><th class="' + c + '">' + s2;
}
r += '</th>';
return r;
}
function getSummaryInnerHtml()
{
var html = '<table class="tcontent" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="top">';
html += '<p>' + localizer.summaryTableDesc + '</p>';
html += '<table class="info" border="0" cellspacing="0" cellpadding="0">';
var stateCount = 0;
for (var staten in dressStates)
{
var state = dressStates[staten];
recalcDresserState(state);
stateCount++;
}
html += getHeaderHtml(false);
var firstChapter = true;
var chapterHtml = '';
var odd = false;
for (var mfi in knownCleanModifiers)
{
var mf = knownCleanModifiers[mfi];
if (mf == '-')
{
if (chapterHtml != '')
{
html += chapterHtml;
html += getHeaderHtml(true);
chapterHtml = '';
odd = false;
}
continue;
}
if (!item_props[mf].view)
{
continue;
}
var hasValues = false;
var maxValue = Number.MIN_VALUE;
for (var staten in dressStates)
{
var state = dressStates[staten];
hasValues |= (state.results[mf] != 0);
if (maxValue < state.results[mf])
{
maxValue = state.results[mf];
}
}
if (!hasValues)
{
continue;
}
chapterHtml += getLeftCellHtml(getItemPropLabel(mf), odd);
for (var staten in dressStates)
{
var state = dressStates[staten];
var v = state.results[mf];
v = getItemPropFormattedValue(mf, v, maxValue);
chapterHtml += getCellHtml(v, odd);
}
chapterHtml += '</tr>';
odd = !odd;
}
if (chapterHtml != '')
{
html += chapterHtml;
html += getHeaderHtml(true);
}
chapterHtml = '';
odd = false;
for (var mf in knownAdvWeaponModifiers)
{
if (!item_props[mf].view)
{
continue;
}
var hasValues = false;
var maxValue = Number.MIN_VALUE;
for (var staten in dressStates)
{
var state = dressStates[staten];
if (mf in state.w3props)
{
var vobj = state.w3props[mf];
if (vobj != null)
{
var vsum = vobj.minv + vobj.maxv;
hasValues = true;
if (maxValue < vsum)
{
maxValue = vsum;
}
}
}
if (mf in state.w10props)
{
var vobj = state.w10props[mf];
if (vobj != null)
{
var vsum = vobj.minv + vobj.maxv;
hasValues = true;
if (maxValue < vsum)
{
maxValue = vsum;
}
}
}
}
if (!hasValues)
{
continue;
}
chapterHtml += getLeftCellHtml(getItemPropLabel(mf), odd);
for (var staten in dressStates)
{
var state = dressStates[staten];
var vhtml = '';
var v = '-';
if (mf in state.w3props)
{
v = getItemPropAdvWeaponHtml(mf, state.w3props[mf], maxValue, true);
}
vhtml += v;
if (mf in state.w10props)
{
v = getItemPropAdvWeaponHtml(mf, state.w10props[mf], maxValue, true);
vhtml += '/' + v;
}
chapterHtml += getCellHtml(vhtml, odd);
}
chapterHtml += '</tr>';
odd = !odd;
}
if (chapterHtml != '')
{
html += chapterHtml;
html += getHeaderHtml(true);
chapterHtml = '';
odd = false;
}
for (var mfi in knownWeaponModifiers)
{
var mf = knownWeaponModifiers[mfi];
if (mf == '-')
{
if (chapterHtml != '')
{
html += chapterHtml;
html += getHeaderHtml(true);
chapterHtml = '';
odd = false;
}
continue;
}
if (!item_props[mf].view)
{
continue;
}
var hasValues = false;
var maxValue = Number.MIN_VALUE;
for (var staten in dressStates)
{
var state = dressStates[staten];
if (mf in state.w3props)
{
var v = state.w3props[mf];
if (mf in state.natural)
{
v += state.natural[mf];
}
hasValues |= (v != 0);
if (maxValue < v)
{
maxValue = v;
}
}
if (mf in state.w10props)
{
var v = state.w10props[mf];
if (mf in state.natural)
{
v += state.natural[mf];
}
hasValues |= (v != 0);
if (maxValue < v)
{
maxValue = v;
}
}
}
if (!hasValues)
{
continue;
}
chapterHtml += getLeftCellHtml(getItemPropLabel(mf), odd);
for (var staten in dressStates)
{
var state = dressStates[staten];
var vhtml = '';
var v = '-';
if (mf in state.w3props)
{
v = state.w3props[mf];
if (mf in state.natural)
{
v += state.natural[mf];
}
v = getItemPropFormattedValue(mf, v, maxValue);
}
vhtml += v;
if (mf in state.w10props)
{
v = state.w10props[mf];
if (mf in state.natural)
{
v += state.natural[mf];
}
v = getItemPropFormattedValue(mf, v, maxValue);
vhtml += '/' + v;
}
chapterHtml += getCellHtml(vhtml, odd);
}
chapterHtml += '</tr>';
odd = !odd;
}
if (chapterHtml != '')
{
html += chapterHtml;
html += getHeaderHtml(true);
}
chapterHtml = '';
odd = false;
for (var mf in knownArmorModifiers)
{
if (!item_props[mf].view)
{
continue;
}
var maxValue = Number.MIN_VALUE;
for (var staten in dressStates)
{
var state = dressStates[staten];
var v1 = state.results[mf + '1'];
var v2 = state.results[mf + '2'];
if (maxValue < (v1 + v2))
{
maxValue = v1 + v2;
}
}
chapterHtml += getLeftCellHtml(getItemPropLabel(mf), odd);
for (var staten in dressStates)
{
var state = dressStates[staten];
var vobj = { minv: state.results[mf + '1'], maxv: state.results[mf + '2'] };
chapterHtml += getCellHtml(getItemPropAdvWeaponHtml(mf, vobj, maxValue, true), odd);
}
chapterHtml += '</tr>';
odd = !odd;
}
if (chapterHtml != '')
{
html += chapterHtml;
html += getHeaderHtml(true);
}
chapterHtml = '';
odd = false;
for (var mf in knownZoneModifiers)
{
if (!item_props[mf].view)
{
continue;
}
var hasValues = false;
var maxValues = { head: 0, body: 0, waist: 0, leg: 0, avg: 0 };
for (var staten in dressStates)
{
var state = dressStates[staten];
if (mf in state.results)
{
var v = state.results[mf];
for (zone in maxValues)
{
if (maxValues[zone] < v[zone])
{
maxValues[zone] = v[zone];
hasValues = true;
}
}
}
}
if (!hasValues)
{
continue;
}
chapterHtml += '<tr><th rowspan="5" class="infoleftth">' + getItemPropLabel(mf) + '</th>';
var firstZone = true;
for (var zone in maxValues)
{
if (firstZone)
{
firstZone = false;
}
else
{
chapterHtml += '</tr><tr>';
odd = !odd;
}
chapterHtml += '<th class="infoleftth">' + localizer['zone' + zone] + '</th>';
for (var staten in dressStates)
{
var state = dressStates[staten];
var v = '-';
if (mf in state.results)
{
v = state.results[mf][zone];
var pcz = getMatvikZoneValue(parseFloat(v));
// if (pcz > 80) pcz = 80; // no more than 80%
if (pcz > 100) pcz = 100; // no more than 100%
pcz = Math.floor(pcz * 100 + 0.5) / 100;
v = getItemPropFormattedValue(mf, v, maxValues[zone]) + ' (' + pcz + '%)';
}
chapterHtml += getCellHtml(v, odd);
}
}
chapterHtml += '</tr>';
odd = !odd;
}
if (chapterHtml != '')
{
html += chapterHtml;
html += getHeaderHtml(true);
}
html += '</table>';
html += '</td></tr></table>';
return html;
}
function showSummary()
{
var summaryDiv = document.getElementById(summaryDivId);
summaryDiv.innerHTML = getSummaryInnerHtml();
summaryDiv.style.display = '';
}
function hideSummary()
{
var summaryDiv = document.getElementById(summaryDivId);
summaryDiv.style.display = 'none';
}
function getExpTableHeaderHtml(separator)
{
var cattr = separator ? ' class="infoseparator"' : '';
var html = '';
if (separator)
{
html += '<tr><th colspan="2"' + cattr + '>';
html += '<hr class="dashed" />';
html += '</th>';
}
else
{
html += '<tr><th width="33%" rowspan="2"' + cattr + '>' + item_props.level.lbl + '</th>';
html += '<th rowspan="2"' + cattr + '>' + item_props.levelup.lbl + '</th>';
html += '<th width="1%"' + cattr + '>|</th>';
html += '<th colspan="5"' + cattr + '>' + localizer.expIncrement + '</th>';
html += '<th width="1%"' + cattr + '>|</th>';
html += '<th colspan="3"' + cattr + '>' + localizer.expTotal + '</th>';
html += '</tr><tr>';
}
html += '<th width="1%"' + cattr + '>|</th>';
html += '<th' + cattr + '>' + localizer.expStats + '</th>';
html += '<th' + cattr + '>' + localizer.expSkills + '</th>';
html += '<th' + cattr + '>' + localizer.expEndurance + '</th>';
html += '<th' + cattr + '>' + localizer.expSpirituality + '</th>';
html += '<th' + cattr + '>' + localizer.expCredits + '</th>';
html += '<th width="1%"' + cattr + '>|</th>';
html += '<th' + cattr + '>' + localizer.expStats + '</th>';
html += '<th' + cattr + '>' + localizer.expExperience + '</th>';
html += '<th' + cattr + '>' + localizer.expCredits + '</th>';
html += '</tr>';
return html;
}
function getExpTableInnerHtml()
{
var html = '<table class="tcontent" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="top">';
html += '<p>' + localizer.expTableDesc + '</p>';
html += '<table width="100%" class="info" border="0" cellspacing="0" cellpadding="0">';
html += getExpTableHeaderHtml(false);
for (var leveln in expd)
{
var level = expd[leveln];
var upc = 1;
if ('count' in level)
{
upc = level.count;
}
html += '<tr>';
html += '<th rowspan="' + upc + '" class="infoleftth">' + item_props.level.lbl + ': ';
html += level.id.toString().bold();
if ('baseExp' in level)
{
html += '<br />' + localizer.expBaseExperience + ': ' + level.baseExp.toString().bold();
}
if ('body' in level)
{
html += '<br />' + localizer.expBody + ': ' + level.body.toString().bold();
}
if ('description' in level)
{
html += '<br />' + localizer.expDescription + ': ' + level.description.bold();
}
html += '</th>';
if ('ups' in level)
{
var firstUp = true;
var odd = false;
for (var upn in level.ups)
{
if (firstUp)
{
firstUp = false;
}
else
{
html += '</tr><tr>';
}
var up = level.ups[upn];
html += '<th class="infoleftth">' + up.id + '</th>';
html += getCellHtml('|', odd)
html += getCellHtml(up.astats, odd)
html += getCellHtml(up.amastery || '', odd)
html += getCellHtml(up.aendurance || '', odd)
html += getCellHtml(up.aspirituality || '', odd)
html += getCellHtml(up.acredits || '', odd)
html += getCellHtml('|', odd)
html += getCellHtml(up.sstats, odd)
html += getCellHtml(up.sexp, odd)
html += getCellHtml(up.scredits.toString(), odd)
odd = !odd;
}
}
if (!('count' in level))
{
html += '<th class="infoleftth"> </th>';
html += '<td colspan="9">' + localizer.expNoInformation + '</td>';
}
html += '</tr>';
html += getExpTableHeaderHtml(true);
}
html += '</table>';
html += '</td></tr></table>';
return html;
}
function showExpTable()
{
var expTableDiv = document.getElementById(expTableDivId);
if (!expTableBuilt)
{
expTableDiv.innerHTML = 'Подождите, пока идёт форматирование таблицы опыта...';
}
expTableDiv.style.display = '';
if (!expTableBuilt)
{
expTableDiv.innerHTML = getExpTableInnerHtml();
expTableBuilt = true;
}
}
function hideExpTable()
{
var expTableDiv = document.getElementById(expTableDivId);
expTableDiv.style.display = 'none';
}
function getCabsAsOptions()
{
var html = '';
var i = 1;
for (var staten in dressStates)
{
var state = dressStates[staten];
html += '<option value="';
html += state.id;
html += '">';
html += localizer.upperCab + ' ' + i;
html += '</option>';
i++;
}
return html;
}
var dressHealerData = new Array(
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 ),
new Array ( 5, 5, 5, 5, 5, 5 )
);
function evaluateHealerPrice()
{
var errorsFound = false;
var html = '';
var sourceState = dressStates[document.getElementById('sourcecab').value];
if (sourceState == null)
{
html += '<p><font color="red">Не выбрана исходная кабинка.</font></p>';
errorsFound = true;
}
var targetState = dressStates[document.getElementById('targetcab').value];
if (targetState == null)
{
html += '<p><font color="red">Не выбрана целевая кабинка.</font></p>';
errorsFound = true;
}
var freeSwapsCount = parseInt(document.getElementById('freeswaps').value);
if (isNaN(freeSwapsCount) || freeSwapsCount < 0)
{
html += '<p><font color="red">Количество оставшихся бесплатных перекидок статов должно быть целым неотрицательным числом.</font></p>';
errorsFound = true;
}
if (freeSwapsCount > 15)
{
html += '<p><font color="red">Количество оставшихся бесплатных перекидок статов не может быть выше 15.</font></p>';
errorsFound = true;
}
if (sourceState == targetState)
{
html += '<p><font color="red">Вы выбрали одну и ту же кабинку в качестве исходной и целевой. Стоимость перекидки равна 0кр.</font></p>';
errorsFound = true;
}
recalcDresserState(sourceState);
recalcDresserState(targetState);
if (sourceState.natural.totalstats != targetState.natural.totalstats)
{
html += '<p><font color="red">Общая сумма родных статов в выбранных кабинках не совпадает.';
html += ' Для исходной кабинки сумма родных статов равна ' + sourceState.natural.totalstats;
html += ', а для целевой кабинки сумма родных статов равна ' + targetState.natural.totalstats;
html += '. Пожалуйста, выровняйте количество родных статов в этих кабинках.</font></p>';
errorsFound = true;
}
if (sourceState.natural.spirituality < targetState.natural.spirituality)
{
html += '<p><font color="red">Значение духовности в целевой кабинке больше, чем в исходной.';
html += '. К сожалению, Администрация БК пока не предоставила нам информацию о стоимости перекидки статов в Духовность.</font></p>';
errorsFound = true;
}
var freeStats = '';
for (var i = 0; i < knownStats.length; i++)
{
var mfname = knownStats[i];
var sval = sourceState.natural[mfname];
var tval = targetState.natural[mfname];
if (tval > sval && tval > dressHealerData.length)
{
html += '<p><font color="red">' + getItemPropLabel(mfname) + ': Значение в целевой кабинке больше, чем мы можем обработать.';
html += 'Для перекидки больше ' + dressHealerData.length + ' статов дешевле воспользоватся кнопкой "Скинуть все" в комнате знахаря.</font></p>';
errorsFound = true;
}
if (tval > sval && tval < 0)
{
html += '<p><font color="red">' + getItemPropLabel(mfname) + ': Значение в целевой кабинке меньше нуля, и больше значения в исходной кабинке.';
html += '. Значения родных статов не могут быть меньше 0.</font></p>';
errorsFound = true;
}
if (sval > tval)
{
if (freeStats != '')
{
freeStats += ', ';
}
freeStats += getItemPropLabel(mfname);
}
}
if (!errorsFound)
{
var history = '';
var price = 0;
for (var i = knownStats.length - 1; i >= 0; i--)
{
if (i >= dressHealerData[0].length)
{
continue;
}
var mfname = knownStats[i];
var sval = sourceState.natural[mfname];
var tval = targetState.natural[mfname];
var diff = tval - sval;
if (diff > 0)
{
for (j = 0; j < diff; j++)
{
if (freeSwapsCount > 0)
{
freeSwapsCount--;
history += 'Перекидываем один стат из [' + freeStats + '] в ' + getItemPropLabel(mfname) + ' бесплатно <i>(' + getItemPropLabel(mfname) + ': было ' + (sval + j).toString() + ', стало ' + (sval + j + 1).toString() + ')</i>.<br />';
}
else
{
var m = sval + j;
var m2 = m - 1;
if (m2 < 0) m2 = 0;
var stepPrice = dressHealerData[m2][i];
price += stepPrice;
history += 'Перекидываем один стат из [' + freeStats + '] в ' + getItemPropLabel(mfname) + ' за ' + stepPrice + 'кр. <i>(' + getItemPropLabel(mfname) + ': было ' + m.toString() + ', стало ' + (m + 1).toString() + ')</i>.<br />';
}
}
}
}
html += '<p>Общая стоимость перекидки статов: <b>' + price + '</b>кр.</p>';
html += '<hr class="dashed" />';
html += history;
}
var healerInfoDiv = document.getElementById('evaluatedHealerInfo');
healerInfoDiv.innerHTML = html;
}
function getHealerInnerHtml()
{
var html = '<table class="tcontent" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="left" valign="top">';
html += '<p>Комната Знахаря позволит Вам оценить затраты на перекидку статов.</p>';
html += '<p>1. Выберите кабинку с исходным комплектом: <select id="sourcecab" name="sourcecab" class="ABTextR">';
html += getCabsAsOptions();
html += '</select><br />';
html += '2. Выберите кабинку с целевым комплектом: <select id="targetcab" name="targetcab" class="ABTextR">';
html += getCabsAsOptions();
html += '</select><br />';
html += '3. Укажите количество оставшихся бесплатных перекидок статов: <input type="text" id="freeswaps" name="freeswaps" value="0" class="ABTextR" size="2" maxlength="2" /><br />';
html += '4. И нажмите на эту кнопку: <input class="inpButton" type="button" id="evaluatehealerprice" name="evaluatehealerprice" value="Рассчитать стоимость перекидки статов" onclick="evaluateHealerPrice(); return false" /></p>';
html += '<div id="evaluatedHealerInfo"></div>';
html += '</td></tr></table>';
return html;
}
function showHealer()
{
var healerDiv = document.getElementById(healerDivId);
healerDiv.innerHTML = getHealerInnerHtml();
healerDiv.style.display = '';
}
function hideHealer()
{
var healerDiv = document.getElementById(healerDivId);
healerDiv.style.display = 'none';
}
function getAttackCount(state)
{
var r = 1;
var w3o = getObjectById(state.objects[slot_w3.index]);
var w10o = getObjectById(state.objects[slot_w10.index]);
if (w10o != null && w10o.slot != 'w3')
{
w10o = null;
}
if (w3o != null && w10o != null)
{
r = 2;
}
var wearedRings = [
state.objects[slot_w6.index],
state.objects[slot_w7.index],
state.objects[slot_w8.index]
];
for (var ri = 0; ri < wearedRings.length; ri++)
{
if (wearedRings[ri] == 'aring5')
{
r += 1;
}
}
return r;
}
function adjustBlockCount(o, firstw, shieldy)
{
if (o == null) return -1;
if (o.category == 'shields') return 1;
if (('properties' in o) && ('blockzones' in o.properties))
{
var bz = o.properties.blockzones.toString();
if (!firstw && (bz == '++'))
{
return 1;
}
if ((!firstw || shieldy) && (bz == '—'))
{
return -1;
}
}
return 0;
}
function getBlockCount(state)
{
var r = 2;
var w3o = getObjectById(state.objects[slot_w3.index]);
var w10o = getObjectById(state.objects[slot_w10.index]);
if (w3o == null)
{
return r;
}
if (w10o != null)
{
r += adjustBlockCount(w3o, true, (w10o.category=='shields'));
r += adjustBlockCount(w10o, false, (w10o.category=='shields'));
}
if (r < 1) r = 1;
if (r > 4) r = 4;
return r;
}
function getBlockZones(blockCount)
{
var bzd = twoBlockZones;
if (blockCount >= 3)
{
bzd = threeBlockZones;
}
return bzd;
}
function updateTurnButton()
{
var noStrike = false;
for (var i = 0; i < turnData.strikes.length; i++)
{
if (turnData.strikes[i] == null)
{
noStrike = true;
break;
}
}
var en = !noStrike && (turnData.blockZones != 0);
document.getElementById('doTurn').disabled = !en;
}
function strikeChosen(id)
{
var el = document.getElementById(id);
var number = parseInt(el.name.substr(4));
var zn = parseInt(el.id.substr(el.name.length + 1));
var v = el.checked;
if (v)
{
turnData.strikes[number] = (zn-1);
}
else
{
if (turnData.strikes[number] == (zn-1))
{
turnData.strikes[number] = null;
}
}
updateTurnButton();
}
function blockChosen(id)
{
var el = document.getElementById(id);
var number = parseInt(el.name.substr(4));
var zn = parseInt(el.id.substr(el.name.length + 1));
var v = el.checked;
if (v)
{
turnData.blockZones |= turnData.bzd[(zn-1)].zones;
}
else
{
turnData.blockZones &= ~turnData.bzd[(zn-1)].zones;
}
updateTurnButton();
}
function doBattleTurn()
{
document.getElementById('battlechoose').innerHTML = 'Ожидаем ответа';
battleRequest();
}
function getBattleTurnParamsHash()
{
var p = {};
for (var i = 0; i < battleTurnParams.length; i++)
{
p[battleTurnParams[i]] = true;
}
return p;
}
function getStateBattleTurnParamsOf(prefix, postfix, data, p)
{
var r = '';
for (var mn in data)
{
if ((mn in p) && (data[mn] != 0))
{
r += '&' + prefix + mn + postfix + '=' + data[mn];
}
}
return r;
}
function getStateBattleTurnParams(postfix, state, p)
{
var r = '';
r += getStateBattleTurnParamsOf('r.', postfix, state.results, p);
r += getStateBattleTurnParamsOf('w3.', postfix, state.w3props, p);
if (hasTwoWeapons(state))
{
r += getStateBattleTurnParamsOf('w0.', postfix, state.w10props, p);
}
return r;
}
function battleRequest()
{
var p = getBattleTurnParamsHash();
br_cleanupScriptElement(battleScriptId);
var href = battleProviderUrl + '?rnd=' + Math.random();
if (hasTwoWeapons(bstate1))
{
href += '&h2w1=1';
}
if (hasTwoWeapons(bstate2))
{
href += '&h2w2=1';
}
for (var i = 0; i < turnData.strikes.length; i++)
{
href += '&s1_' + i + '=' + turnData.strikes[i];
}
href += '&bz1=' + turnData.blockZones;
href += getStateBattleTurnParams('.1', bstate1, p);
href += getStateBattleTurnParams('.2', bstate2, p);
if (isDeveloperMode()) informAboutProgress(href);
br_getScriptElement(battleScriptId, href);
}
function br_cleanupScriptElement(id)
{
var span = document.getElementById(id);
if (span != null)
{
setTimeout(function()
{
// without setTimeout - crash in IE 5.0!
span.parentNode.removeChild(span);
},
50
);
}
}
function br_getScriptElement(id, href)
{
var span = document.body.appendChild(document.createElement('SPAN'));
span.style.display = 'none';
span.innerHTML = 'MSIE fix<s' + 'cript></s' + 'cript>';
setTimeout(function()
{
var s = span.getElementsByTagName("script")[0];
s.language = "JavaScript";
if (s.setAttribute) s.setAttribute('src', href); else s.src = href;
},
10
);
return span;
}
var bstate1;
var bstate2;
function handleBattleResponse(response)
{
var line = response.line;
document.getElementById('xx_battlescreen').innerHTML = getBattleScreenHtml();
var logelt = document.getElementById('xx_battlelog');
line = '<div style="border-bottom: solid 1px #222222;">' + line + '</div>';
if (logelt.insertAdjacentHTML)
{
logelt.insertAdjacentHTML('afterBegin', line);
}
else
{
logelt.innerHTML = line + logelt.innerHTML;
}
}
function getStrikeBlockSelector(attackCount, blockCount)
{
var html = '';
var bzd = getBlockZones(blockCount);
turnData = { bzd: bzd, strikes: new Array(attackCount), blockZones: 0 };
html += '<table width="100%" border="0" cellspacing="0" cellpadding="8"><tr>';
for (azi = 0; azi < attackCount; azi++)
{
html += '<td valign="top">';
html += '<label>Удар</label>';
var rn = 'atck' + azi;
for (var i = 0; i < localizer.attackZone.length; i++)
{
var id = rn + '_' + (i+1);
html += '<br />';
html += '<input id="' + id + '" type="radio" value="' + i + '" name="' + rn + '" onclick="strikeChosen(' + "'" + id + "'" + ')" />';
html += '<label for="' + id + '">' + localizer.attackZone[i] + '</label>';
}
}
html += '</td><td valign="top">';
html += '<label>Блок</label>';
var rn = 'blck0';
for (var i = 0; i < bzd.length; i++)
{
var id = rn + '_' + (i+1);
html += '<br />';
html += '<input id="' + id + '" type="radio" value="' + bzd[i].zones + '" name="' + rn + '" onclick="blockChosen(' + "'" + id + "'" + ')" />';
html += '<label for="' + id + '">' + bzd[i].name + '</label>';
}
html += '</td></tr></table>';
html += '<input id="doTurn" class="inpButton" type="button" onclick="doBattleTurn()" value="' + localizer.goStrike + '" disabled="yes" />';
return html;
}
function getBattleScreenHtml()
{
var html = '';
html += '<div id="xx_battlescreen"><table width="100%" cellpadding="0" cellspacing="0"><tr>';
html += '<td width="240" valign="top">' + getSimplePersImageHtml(bstate1, true) + '</td>';
html += '<td align="center" valign="top" id="battlechoose">';
html += getStrikeBlockSelector(bstate1.results.attackcount, bstate1.results.blockcount);
html += '</td>';
html += '<td width="240" valign="top">' + getSimplePersImageHtml(bstate2, false) + '</td>';
html += '</tr></table></div>';
return html;
}
function clearBattleState(state)
{
for (var mf in knownWeaponModifiersHash)
{
if (!(mf in state.natural))
{
continue;
}
if (mf in state.w3props)
{
state.w3props[mf] += state.natural[mf];
}
if (mf in state.w10props)
{
state.w10props[mf] += state.natural[mf];
}
delete state.results[mf];
}
state.inbattle.hitpoints = state.results.hitpoints;
state.inbattle.mana = state.results.mana;
}
function startBattle()
{
var s1 = dressStates[document.getElementById('bcab1').value];
var s2 = dressStates[document.getElementById('bcab2').value];
bstate1 = cloneObject(s1);
bstate2 = cloneObject(s2);
clearBattleState(bstate1);
clearBattleState(bstate2);
var html = '';
html += getBattleScreenHtml();
html += '<hr class="dashed" />';
html += '<div id="xx_battlelog"> </div>';
var battlesDiv = document.getElementById(battlesDivId);
battlesDiv.innerHTML = html;
}
function getBattlesInnerHtml()
{
var html = '<table class="tcontent" width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td align="left" valign="top">';
html += '<p>Здесь Вы можете провести тестовые поединки.</p>';
html += '<p><font color="red">Вплоть до официального релиза поединков оные будут лимитированы. Сперва появятся только поединки бойцов, и только потом появится магия.</font></p>';
html += '<p>1. Выберите кабинку со своим комплектом: <select id="bcab1" name="bcab1" class="ABTextR">';
html += getCabsAsOptions();
html += '</select><br />';
html += '2. Выберите кабинку с комплектом противника: <select id="bcab2" name="bcab2" class="ABTextR">';
html += getCabsAsOptions();
html += '</select><br />';
html += '3. И нажмите на эту кнопку: <input class="inpButton" type="button" id="startbattle" name="startbattle" value="Начать поединок один на один" onclick="startBattle(); return false" /></p>';
html += '</td></tr></table>';
return html;
}
function showBattles()
{
var battlesDiv = document.getElementById(battlesDivId);
battlesDiv.innerHTML = getBattlesInnerHtml();
battlesDiv.style.display = '';
}
function hideBattles()
{
var battlesDiv = document.getElementById(battlesDivId);
battlesDiv.style.display = 'none';
}
function getFake(oid)
{
var o = getObjectById(oid);
var r = o.upgrade[getJSName(oid) + '_fake'];
if (!('caption' in r))
{
r.caption = o.caption;
}
r.category = o.category;
r.slot = o.slot;
r.width = o.width;
r.height = o.height;
return r;
}
function getCommonItemList()
{
return common_props;
}
function getSelectItemListHtml(prefix, list)
{
var html = '';
html += '<select id="' + prefix + 'itemListChooser">';
for (var mf in list)
{
var data = list[mf];
var lbl = data.lbl;
html += '<option value="' + mf + '">' + lbl + '</option>';
}
html += '</select>';
return html;
}
function applyFakeParam(id)
{
var value = parseFloat(document.getElementById('fakeParamValue').value);
if (isNaN(value))
{
alert('Введите число.');
return;
}
var o = getObjectById(id);
if ('upgradecache' in o)
{
delete o.upgradecache;
}
var fake = getFake(id);
if (!('common' in fake))
{
fake.common = {};
}
if (value != 0)
{
fake.common[document.getElementById('cmnitemListChooser').value] = value;
}
else
{
delete fake.common[document.getElementById('cmnitemListChooser').value];
}
document.getElementById('buildings').innerHTML = getFakeItemEditor(id);
}
function addFakeParam(id)
{
var html = '';
html += getSelectItemListHtml('cmn', getCommonItemList());
html += '<br /><input id="fakeParamValue" type="text" value="0" />';
html += '<br /><input class="inpButton" type="button" value="Добавить" onclick="applyFakeParam(' + "'" + id + "'" + ')" /></div>';
document.getElementById('param_newline').innerHTML = html;
}
function getBoolItemList(boolvar)
{
var r = {};
for (var mf in item_props)
{
var data = item_props[mf];
if ((boolvar in data) && data[boolvar])
{
r[mf] = data;
}
}
return r;
}
function getRequiredItemList()
{
return getBoolItemList('required');
}
function applyFakeReq(id)
{
var value = document.getElementById('fakeReqValue').value;
if (isNaN(value))
{
alert('Введите число.');
return;
}
var o = getObjectById(id);
if ('upgradecache' in o)
{
delete o.upgradecache;
}
var fake = getFake(id);
if (!('required' in fake))
{
fake.required = {};
}
if (value > 0)
{
fake.required[document.getElementById('reqitemListChooser').value] = value;
}
else
{
delete fake.required[document.getElementById('reqitemListChooser').value];
}
document.getElementById('buildings').innerHTML = getFakeItemEditor(id);
}
function addFakeReq(id)
{
var html = '';
html += getSelectItemListHtml('req', getRequiredItemList());
html += '<br /><input id="fakeReqValue" type="text" value="0" />';
html += '<br /><input class="inpButton" type="button" value="Добавить" onclick="applyFakeReq(' + "'" + id + "'" + ')" /></div>';
document.getElementById('req_newline').innerHTML = html;
}
function getCleanModifyItemList()
{
return getBoolItemList('inmfg');
}
function applyFakeCleanMf(id)
{
var value = document.getElementById('fakeMfValue').value;
if (isNaN(value))
{
alert('Введите число.');
return;
}
var o = getObjectById(id);
if ('upgradecache' in o)
{
delete o.upgradecache;
}
var fake = getFake(id);
if (!('modify' in fake))
{
fake.modify = {};
}
if (value != 0)
{
fake.modify[document.getElementById('cmfitemListChooser').value] = value;
}
else
{
delete fake.modify[document.getElementById('cmfitemListChooser').value];
}
document.getElementById('buildings').innerHTML = getFakeItemEditor(id);
}
function addFakeCleanMf(id)
{
var html = '';
html += getSelectItemListHtml('cmf', getCleanModifyItemList());
html += '<br /><input id="fakeMfValue" type="text" value="0" />';
html += '<br /><input class="inpButton" type="button" value="Добавить" onclick="applyFakeCleanMf(' + "'" + id + "'" + ')" /></div>';
document.getElementById('mf_newline').innerHTML = html;
}
function getCleanPropertiesItemList()
{
return getBoolItemList('inprpg');
}
function applyFakeCleanPrp(id)
{
var value = document.getElementById('fakePrpValue').value;
if (isNaN(value))
{
alert('Введите число.');
return;
}
var o = getObjectById(id);
if ('upgradecache' in o)
{
delete o.upgradecache;
}
var fake = getFake(id);
if (!('properties' in fake))
{
fake.properties = {};
}
if (value != 0)
{
fake.properties[document.getElementById('prpitemListChooser').value] = value;
}
else
{
delete fake.properties[document.getElementById('prpitemListChooser').value];
}
document.getElementById('buildings').innerHTML = getFakeItemEditor(id);
}
function addFakeCleanPrp(id)
{
var html = '';
html += getSelectItemListHtml('prp', getCleanPropertiesItemList());
html += '<br /><input id="fakePrpValue" type="text" value="0" />';
html += '<br /><input class="inpButton" type="button" value="Добавить" onclick="applyFakeCleanPrp(' + "'" + id + "'" + ')" /></div>';
document.getElementById('prp_newline').innerHTML = html;
}
function renameFake(id)
{
var o = getObjectById(id);
var fake = getFake(id);
var caption = o.caption;
if ('caption' in fake)
{
caption = fake.caption;
}
caption = window.prompt('Введите имя предмета', caption);
if (caption != null)
{
if (caption == o.caption)
{
if ('caption' in fake)
{
delete fake.caption;
}
}
else
{
fake.caption = caption;
}
}
if ('upgradecache' in o)
{
delete o.upgradecache;
}
document.getElementById('buildings').innerHTML = getFakeItemEditor(id);
}
function getFakeItemEditor(id)
{
var html = '';
var fake = getFake(id);
html += categories[fake.category].caption.bold() + '<hr class="dashed" />';
html += format('<img border="0" align="right" src="{0}{1}.gif" width="{2}" height="{3}" />', itemImgPath, id, fake.width, fake.height);
html += '<b>' + getUpgradeCaption(getObjectById(id), fake) + '</b> ';
html += '<input class="inpButton" type="button" value="Переименовать" onclick="renameFake(' + "'" + id + "'" + ')" /><br />';
if ('common' in fake)
{
for (var mf in fake.common)
{
html += getHtmlOfProp(null, fake.common, common_props[mf], mf);
}
}
html += '<div id="param_newline"><input class="inpButton" type="button" value="Добавить в Параметры" onclick="addFakeParam(' + "'" + id + "'" + ')" /></div>';
html += localizer.itemRequiredGroup.bold() + '<br />';
if ('required' in fake)
{
for (var mf in fake.required)
{
html += getHtmlOfProp(null, fake.required, item_props[mf], mf);
}
}
html += '<div id="req_newline"><input class="inpButton" type="button" value="Добавить в Требования" onclick="addFakeReq(' + "'" + id + "'" + ')" /></div>';
html += localizer.itemModifyGroup.bold() + '<br />';
if ('modify' in fake)
{
for (var mf in fake.modify)
{
if (mf in knownArmorModifiers)
{
continue;
}
html += getHtmlOfSignedProp(fake.modify, item_props[mf], mf, null, null, null);
}
for (var armorn in knownArmorModifiers)
{
html += getHtmlOfArmorProp(fake.modify, armorn, getItemPropLabel(armorn));
}
}
html += '<div id="mf_newline"><input class="inpButton" type="button" value="Добавить в Действует на" onclick="addFakeCleanMf(' + "'" + id + "'" + ')" /></div>';
html += localizer.itemPropertiesGroup.bold() + '<br />';
if ('properties' in fake)
{
for (var mf in fake.properties)
{
html += getHtmlOfSignedProp(fake.properties, item_props[mf], mf, null, null, null);
}
}
html += '<div id="prp_newline"><input class="inpButton" type="button" value="Добавить в Свойства предмета" onclick="addFakeCleanPrp(' + "'" + id + "'" + ')" /></div>';
return html;
}
function createFake(id, fake)
{
var c = categories[fake.category];
var slot = getSlotById(c.slot);
var oidx = getJSName(id);
if (!(oidx in dressItems))
{
dressItems[oidx] = {id: id, fakebase: true, caption: fake.caption, category: c.id, slot: c.slot, width: slot.width, height: slot.height};
c.items.push(dressItems[oidx]);
}
var o = getObjectById(id);
if (!('upgrade' in o))
{
o.upgrade = {};
}
o.upgrade[oidx + '_fake'] = fake;
}
function builderEditItem(isNewItem)
{
var ci = document.getElementById('builderCategoryChooser').value;
var c = categories[ci];
var slot = getSlotById(c.slot);
var id = '';
if (isNewItem)
{
id = document.getElementById('builderItemComposeName').value;
var slashIndex = id.lastIndexOf('/');
if (slashIndex >= 0)
{
id = id.substr(slashIndex + 1);
}
var gifIndex = id.lastIndexOf('.gif');
if (gifIndex >= 0)
{
id = id.substr(0, gifIndex);
}
if (getObjectById(id) != null)
{
alert('Предмет с таким кодом уже существует!');
return;
}
}
else
{
id = document.getElementById('builderItemChooser').value;
}
if (id == '')
{
alert('Пустое имя предмета');
return;
}
var oidx = getJSName(id);
if (!(oidx in dressItems))
{
dressItems[oidx] = {id: id, fakebase: true, caption: 'Новый предмет', category: c.id, slot: c.slot, width: slot.width, height: slot.height};
c.items.push(dressItems[oidx]);
for (var ci in categories)
{
var oc = categories[ci];
if (('basecat' in oc) && (oc.basecat == c) && (oc.items != c.items))
{
oc.items.push(dressItems[oidx]);
}
}
}
if (!(oidx in dressExData.fakes))
{
var o = getObjectById(id);
if (!('upgrade' in o))
{
o.upgrade = {};
}
o.upgrade[oidx + '_fake'] = {id: id + '_fake', fake: Math.random()};
if (!isNewItem)
{
o.upgrade[oidx + '_fake'] = combineObjects(o, o.upgrade[oidx + '_fake']);
}
dressExData.fakes[oidx] = id;
}
document.getElementById('buildings').innerHTML = getFakeItemEditor(id);
}
function rebuildItems()
{
var ci = document.getElementById('builderCategoryChooser').value;
if (ci == null || ci == '')
{
document.getElementById('builderItemChooserDiv').innerHTML = '';
return;
}
var html = '';
html += '<select id="builderItemChooser">';
var c = categories[ci];
var items = getFilteredItems(c.items);
for (var iti in items)
{
var it = items[iti];
html += '<option value="' + it.id + '">' + htmlstring(it.caption) + '</option>';
}
html += '</select>';
html += '<br /><input class="inpButton" type="button" value="Открыть в конструкторе" onclick="builderEditItem(false);" />';
document.getElementById('builderItemChooserDiv').innerHTML = html;
}
function builderChooseItem()
{
var html = '';
html += 'Выберите предмет для начала конструирования<br />';
html += '<select id="builderCategoryChooser" onchange="rebuildItems()">';
for (var ci in categories)
{
var c = categories[ci];
if ((c.id == 'emptyitems') || ('basecat' in c))
{
continue;
}
html += '<option value="' + ci + '">';
html += htmlstring(c.caption);
html += '</option>';
}
html += '</select>';
html += '<div id="builderItemChooserDiv"> </div>';
document.getElementById('buildings').innerHTML = html;
rebuildItems();
}
function builderComposeItem()
{
var html = '';
html += 'Введите код предмета или ссылку на его изображение<br />';
html += '<select id="builderCategoryChooser">';
for (var ci in categories)
{
var c = categories[ci];
if (c.id == 'emptyitems')
{
continue;
}
html += '<option value="' + ci + '">';
html += htmlstring(c.caption);
html += '</option>';
}
html += '</select>';
html += '<br /><input id="builderItemComposeName" type="text" value="" />';
html += '<br /><input class="inpButton" type="button" value="Открыть в конструкторе" onclick="builderEditItem(true);" />';
document.getElementById('buildings').innerHTML = html;
}
function dropItemFromCategoryItems(c, o)
{
for (var i = 0; i < c.items.length; i++)
{
if (c.items[i] == o)
{
delete c.items[i];
break;
}
}
}
function builderDropItem()
{
var id = document.getElementById('builderItemChooser').value;
var o = getObjectById(id);
delete o.upgrade[id + '_fake'];
var hasUpgrades = false;
for (var ui in o.upgrade)
{
hasUpgrades = true;
break;
}
if (!hasUpgrades)
{
delete o.upgrade;
}
delete dressExData.fakes[getJSName(id)];
if ('fakebase' in o)
{
var c = categories[o.category];
dropItemFromCategoryItems(c, o);
for (var ci in categories)
{
var oc = categories[ci];
if (('basecat' in oc) && (oc.basecat == c) && (oc.items != c.items))
{
dropItemFromCategoryItems(oc, o);
}
}
delete dressItems[getJSName(id)];
}
showBuilder();
}
function builderForgotItem()
{
var html = '';
html += 'Выберите предмет для забывания<br />';
html += '<select id="builderItemChooser">';
var items = [];
for (var fi in dressExData.fakes)
{
items.push(getObjectById(dressExData.fakes[fi]));
}
for (var iti in items)
{
var it = items[iti];
html += '<option value="' + it.id + '">' + htmlstring(it.caption) + '</option>';
}
html += '</select>';
html += '<br /><input class="inpButton" type="button" value="Забыть в конструкторе" onclick="builderDropItem();" />';
document.getElementById('buildings').innerHTML = html;
}
function getBuilderCommands()
{
var html = '<table cellpadding="0" cellspacing="0" border="0"><tr>';
html += getCell2MenuItemHtml('Модифицировать известный предмет', 'builderChooseItem()');
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml('Создать новый предмет', 'builderComposeItem()');
html += getCell2MenuSeparatorHtml();
html += getCell2MenuItemHtml('Забыть сконструированный предмет', 'builderForgotItem()');
html += '</table>';
return html;
}
function getBuilderInnerHtml()
{
var html = '';
html += getBuilderCommands();
html += '<div id="buildings">';
html += '<p><font color="red">Конструктор в режиме тестирования и реализации, использовать пока не рекомендуется.</font></p>';
html += '<p>Здесь Вы можете конструировать свои предметы или модифицировать существующие.</p>';
html += '<p>Ресурс полезен при изменениях в мире БК любым игрокам, а также перед оными для гейм-мастеров.</p>';
html += '</div>';
return html;
}
function showBuilder()
{
var builderDiv = document.getElementById(builderDivId);
builderDiv.innerHTML = getBuilderInnerHtml();
builderDiv.style.display = '';
}
function hideBuilder()
{
var builderDiv = document.getElementById(builderDivId);
builderDiv.style.display = 'none';
}
function recalcDresserWeaponState(state, wslot)
{
var r = {};
var objid;
var o;
var doublesO = getObjectByStateSlot(state, getSlotById(wslot.id === 'w3' ? 'w10' : 'w3'));
for (var mfname in knownWeaponModifiersHash)
{
var mfvalue = 0;
for (var sloti = 0; sloti < slots.length; sloti++)
{
var slot = slots[sloti];
o = getObjectByStateSlot(state, slot);
if (o == null)
{
continue;
}
if (('modify' in o) && (mfname in o.modify))
{
mfvalue += parseInt(o.modify[mfname]);
}
}
for (var seti = 0; seti < state.appliedSets.length; seti++)
{
var set = state.appliedSets[seti];
if (('modify' in set) && (mfname in set.modify))
{
mfvalue += parseInt(set.modify[mfname]);
}
}
for (var strgi = 0; strgi < state.appliedStrengthenings.length; strgi++)
{
var strg = state.appliedStrengthenings[strgi];
if (('modify' in strg) && (mfname in strg.modify))
{
mfvalue += parseInt(strg.modify[mfname]);
}
}
o = getObjectByStateSlot(state, wslot);
if (o != null)
{
if (('properties' in o) && (mfname in o.properties))
{
mfvalue += parseInt(o.properties[mfname]);
}
}
if (o == null && wslot.id != 'w3')
{
continue;
}
// Emulate bug with weapon's damage properties
if (doublesO != null && ['power', 'thrustpower', 'sabrepower', 'crushpower', 'cutpower'].indexOf(mfname) != -1) {
if ('properties' in doublesO && mfname in doublesO.properties) {
mfvalue += parseInt(doublesO.properties[mfname]);
}
}
r[mfname] = mfvalue;
}
for (var powerupn in state.spellPowerUps)
{
if (powerupn in knownECRPowerUps)
{
var epowerup = knownECRPowerUps[powerupn];
if (epowerup.modify in knownWeaponModifiersHash)
{
r[epowerup.modify] += epowerup.v;
}
}
}
return r;
}
function calculateBaseWeaponIndices(state, wslot, o)
{
var strength = 0;
var mindamage = 0;
var maxdamage = 0;
var postmindamage = 0;
var postmaxdamage = 0;
var powermf = 0;
var magicpowermf = 0;
var skill = getWeaponSkillValue(state, wslot);
var attacks = getAttackFreq(o);
for (var sloti = 0; sloti < slots.length; sloti++)
{
var slot = slots[sloti];
if (slot == wslot) continue;
var so = getObjectByStateSlot(state, slot);
if (so == null)
{
continue;
}
if ('modify' in so)
{
if ('mindamage' in so.modify)
{
postmindamage += parseInt(so.modify.mindamage);
}
if ('maxdamage' in so.modify)
{
postmaxdamage += parseInt(so.modify.maxdamage);
}
}
}
for (var i = 0; i < state.appliedStrengthenings.length; i++)
{
var strengthening = state.appliedStrengthenings[i];
if ('modify' in strengthening)
{
if ('mindamage' in strengthening.modify)
{
postmindamage += parseInt(strengthening.modify.mindamage);
}
if ('maxdamage' in strengthening.modify)
{
postmaxdamage += parseInt(strengthening.modify.maxdamage);
}
}
}
if (o != null)
{
if ('modify' in o)
{
if ('mindamage' in o.modify)
{
mindamage += parseInt(o.modify.mindamage);
}
if ('maxdamage' in o.modify)
{
maxdamage += parseInt(o.modify.maxdamage);
}
}
if ('properties' in o)
{
if ('mindamage' in o.properties)
{
mindamage += parseInt(o.properties.mindamage);
}
if ('maxdamage' in o.properties)
{
maxdamage += parseInt(o.properties.maxdamage);
}
}
}
// mindamage += state.natural.level;
// maxdamage += state.natural.level;
if (o != null)
{
/*if (isTwohandledWeapon(o))
{
skill *= 1.2;
}*/
var statBonuses = categories[o.category].statBonuses;
if (statBonuses != null)
{
for (var statName in statBonuses)
{
if (statName in state.results)
{
var bonus = (state.results[statName] * statBonuses[statName]) / 100.0;
strength += bonus;
}
}
}
}
/*else
{
// test no weapons
if (wslot.id == 'w3' && getObjectByStateSlot(state, slot_w10) == null)
{
mindamage += 2;
maxdamage += 4;
if ('strength' in state.results)
{
strength += state.results.strength;
}
if (strength <= 100)
{
strength *= 2;
}
else
{
strength += 100;
}
}
}
if (hasTwohandledWeapon(state))
{
strength *= 1.1;
}*/
var cpower = 0;
if ('criticalpower' in state[wslot.id + 'props'])
{
cpower = state[wslot.id + 'props'].criticalpower;
if ('criticalpower' in state.natural)
{
cpower += state.natural.criticalpower;
}
}
else if ('criticalpower' in state.results)
{
cpower = state.results.criticalpower;
}
for (var delixn in state.damageElixes)
{
var delix = knownDamageElix[delixn];
if (!('modify' in delix)) continue;
if ('power' in delix.modify)
{
powermf += delix.modify.power;
}
if ('magicpower' in delix.modify)
{
magicpowermf += delix.modify.magicpower;
}
if ('mindamage' in delix.modify)
{
postmindamage += delix.modify.mindamage;
}
if ('maxdamage' in delix.modify)
{
postmaxdamage += delix.modify.maxdamage;
}
}
for (var powerupn in state.spellPowerUps)
{
if (powerupn in knownECRPowerUps)
{
if (knownECRPowerUps[powerupn].modifyExt !== undefined) {
for (var epowerup in knownECRPowerUps[powerupn].modifyExt) {
if (epowerup ==='maxdamage') {
postmaxdamage += knownECRPowerUps[powerupn].modifyExt[epowerup];
}
}
}
}
}
if ('spell_powerup10' in state.spellPowerUps)
{
powermf += state.spellPowerUps.spell_powerup10;
}
return {strength: strength, skill: skill, mindamage: mindamage, maxdamage: maxdamage, cpower: cpower, attacks: attacks, powermf: powermf, magicpowermf: magicpowermf, postmindamage: postmindamage, postmaxdamage: postmaxdamage};
}
function getPowerMfValue(state, wslot, powermfn)
{
var powerMfValue = 0;
if (powermfn in state[wslot.id + 'props'])
{
powerMfValue = state[wslot.id + 'props'][powermfn];
if (powermfn in state.natural)
{
powerMfValue += state.natural[powermfn];
}
}
else if (powermfn in state.results)
{
powerMfValue = state.results[powermfn];
}
return powerMfValue;
}
function calculateAttackDamage(state, wslot, o, baseIndices, attackn)
{
var attack = baseIndices.attacks[attackn];
var k1 = 1 + (baseIndices.strength / 300.0);
var k2 = 1 + (baseIndices.skill * 0.075);
var k4 = 0.97;
var k2e = 1;
var mindamage = baseIndices.mindamage + (baseIndices.strength / 5);
var maxdamage = baseIndices.maxdamage + (baseIndices.strength / 5);
if (mindamage < 0 || mindamage > maxdamage)
{
mindamage = 0;
}
var powermfn = attackn + 'power';
var powerMfValue = baseIndices.powermf;
if (attack.elemental)
{
powermfn = attackn + 'magicpower';
var estrength = 0;
for (var powerupn in state.spellPowerUps)
{
if (!(powerupn in knownPowerUps))
{
continue;
}
var powerup = knownPowerUps[powerupn];
if (powerup.damageup && ('element' in powerup))
{
if (attackn != powerup.element)
{
continue;
}
estrength = baseIndices.strength * 0.01 * state.spellPowerUps[powerupn];
}
}
var eskill = getWeaponSkillValueOf(state, o, (attackn + 'magicskill'));
k2e += (estrength / 300.0) + (eskill * 0.050);
// k2 = 1 + ((k2 - 1) / 2);
powerMfValue += getPowerMfValue(state, wslot, 'magicpower');
powerMfValue += baseIndices.magicpowermf;
}
// else
// {
powerMfValue += getPowerMfValue(state, wslot, 'power');
// }
powerMfValue += getPowerMfValue(state, wslot, powermfn);
mindamage *= k1 * k2;
maxdamage *= k1 * k2;
var k3 = 1 + (powerMfValue / 100.0);
var damage1 = mindamage * k2e * k3 * k4;
var damage2 = maxdamage * k2e * k3 * k4;
mindamage += baseIndices.postmindamage;
maxdamage += baseIndices.postmaxdamage;
damage1 += baseIndices.postmindamage;
damage2 += baseIndices.postmaxdamage;
var cdamage1 = (damage1 + damage1) * (1 + (baseIndices.cpower / 100.0));
var cdamage2 = (damage2 + damage2) * (1 + (baseIndices.cpower / 100.0));
return {
id: attackn,
attack: attack,
damage: {minv:mindamage, maxv:maxdamage},
mfdamage: {minv:damage1, maxv:damage2},
mfcdamage: {minv:cdamage1, maxv:cdamage2},
postdamage: {minv:baseIndices.postmindamage, maxv:baseIndices.postmaxdamage},
_power_v: powerMfValue
};
}
function calculateAttackDamage2(state, wslot, o, baseIndices, attackn)
{
var attack = baseIndices.attacks[attackn],
powermfn = attackn + 'power',
powerMfValue = baseIndices.powermf + getPowerMfValue(state, wslot, 'power') + getPowerMfValue(state, wslot, powermfn),
slotPropName = wslot.id + 'props',
strength = state.results.strength,
dexterity = state.results.dexterity,
intuition = state.results.intuition,
min_damage_base = Math.round(strength / 3.0 + state.results.level + baseIndices.postmindamage),
max_damage_base = Math.round(strength / 3.0 + state.results.level + baseIndices.postmaxdamage),
min_damage = min_damage_base,
max_damage = max_damage_base,
min_damage_critical = min_damage * 2.0,
max_damage_critical = max_damage * 2.0;
min_damage_weapon = ((o != null && 'properties' in o) ? o.properties.mindamage : 0),
max_damage_weapon = ((o != null && 'properties' in o) ? o.properties.maxdamage : 0),
weaponskill = baseIndices.skill,
stats_damage_effect = 0,
criticalpower = (slotPropName in state && 'criticalpower' in state[slotPropName]) ? state[slotPropName].criticalpower : 0;
switch (attackn) {
case 'crush':
stats_damage_effect = strength * 1.0;
break;
case 'thrust':
stats_damage_effect = strength * 0.4 + dexterity * 0.6;
break;
case 'cut':
stats_damage_effect = strength * 0.3 + intuition * 0.7;
break;
case 'sabre':
stats_damage_effect = strength * 0.6 + dexterity * 0.2 + intuition * 0.2;
break;
default:
break;
}
if (o != null && 'properties' in o) {
min_damage = (min_damage_base + stats_damage_effect + min_damage_weapon * (1 + 0.07 * weaponskill)) * (1.0 + powerMfValue / 100.0);
max_damage = (max_damage_base + stats_damage_effect + max_damage_weapon * (1 + 0.07 * weaponskill)) * (1.0 + powerMfValue / 100.0);
min_damage_critical = min_damage * 2.0 * (1.0 + criticalpower / 100.0);
max_damage_critical = max_damage * 2.0 * (1.0 + criticalpower / 100.0);
}
return {
id: attackn,
attack: attack,
damage: {minv:min_damage_base, maxv:max_damage_base},
mfdamage: {minv:min_damage, maxv:max_damage},
mfcdamage: {minv:min_damage_critical, maxv:max_damage_critical},
postdamage: {minv:0, maxv:0},
_power_v: powerMfValue
};
}
function addToDamage(averages, concrete, percentage)
{
averages.minv += concrete.minv * percentage / 100.0;
averages.maxv += concrete.maxv * percentage / 100.0;
}
function floorDamage(damage)
{
damage.minv = Math.floor(damage.minv + 0.5);
damage.maxv = Math.floor(damage.maxv + 0.5);
}
function floorDamages(damages)
{
floorDamage(damages.damage);
floorDamage(damages.mfdamage);
floorDamage(damages.mfcdamage);
}
function recalcDresserWeaponAdvState(state, wslot)
{
var o = getObjectByStateSlot(state, wslot);
var baseIndices = calculateBaseWeaponIndices(state, wslot, o);
/*
if ('spell_powerup10' in state.spellPowerUps)
{
baseIndices.strength *= 1 + (0.01 * state.spellPowerUps.spell_powerup10);
}
baseIndices.mindamage += (baseIndices.strength / 3);
baseIndices.maxdamage += (baseIndices.strength / 3);*/
// calculate averages in parallel
var finalData = {};
var averages = {damage: {minv:0, maxv:0}, mfdamage: {minv:0, maxv:0}, mfcdamage: {minv:0, maxv:0}};
for (var attackn in baseIndices.attacks)
{
var fd = calculateAttackDamage2(state, wslot, o, baseIndices, attackn);
addToDamage(averages.damage, fd.damage, fd.attack.real);
addToDamage(averages.mfdamage, fd.mfdamage, fd.attack.real);
addToDamage(averages.mfcdamage, fd.mfcdamage, fd.attack.real);
floorDamages(fd);
finalData[attackn] = fd;
}
floorDamages(averages);
state[wslot.id + 'props'].damage = averages.damage;
state[wslot.id + 'props'].mfdamage = averages.mfdamage;
state[wslot.id + 'props'].mfcdamage = averages.mfcdamage;
state[wslot.id + 'props'].damages = finalData;
}
function recalcDresserCombatSpellsState(state)
{
var spellsFound = {};
for (var spellBase in combatSpells)
{
var spello = combatSpells[spellBase];
for (var sloti = 0; sloti < slots.length; sloti++)
{
var slot = slots[sloti];
var o = getObjectByStateSlot(state, slot);
if (o == null)
{
continue;
}
if (o.id.substr(0, spello.id.length) == spello.id && ('required' in o) && ('mana' in o.required))
{
var b = o.id.substr(spello.id.length);
spellsFound[getJSName(o.id)] = {spell: o, evd: spello, b: parseInt(b)};
}
}
}
state.combatSpells = {};
for (var sid in spellsFound)
{
var spell = spellsFound[sid];
var skillname = spell.evd.magic + 'magicskill';
var maxdamage = spell.b;
var skill = state.results[skillname];
maxdamage += state.natural.level;
var mf1 = 1 + (skill * 0.072);
var mf2 = 1;
mf2 += state.results[spell.evd.magic + 'magicpower'] * 0.01;
if (spell.evd.elemental)
{
mf2 += state.results['magicpower'] * 0.01;
}
maxdamage *= mf1;
maxdamage *= mf2;
maxdamage *= 0.97;
if (maxdamage > (spell.b * 10))
{
maxdamage = spell.b * 10;
}
var mindamage = (spell.evd.minzero ? 0.0 : (maxdamage * 0.9))
maxdamage *= 1.02;
var mincdamage = mindamage * spell.evd.critMultiplier;
var maxcdamage = maxdamage * spell.evd.critMultiplier;
state.combatSpells[spell.spell.id] = { magic_damage: {minv: Math.floor(mindamage), maxv: Math.floor(maxdamage)}, magic_cdamage: {minv: Math.floor(mincdamage), maxv: Math.floor(maxcdamage)} };
}
}
function calcResults(state)
{
for (var mfname in item_props)
{
if (mfname in knownZoneModifiers)
{
continue;
}
var vm = state.modify[mfname];
var vn = state.natural[mfname];
state.results[mfname] = (vm + vn);
}
}
function calcArmors(state)
{
var avgarmor1 = 0;
var avgarmor2 = 0;
for (var mfname in knownArmorModifiers)
{
if (mfname == 'avgarmor')
{
continue;
}
var mina = 0;
var maxa = 0;
for (var sloti = 0; sloti < slots.length; sloti++)
{
var slot = slots[sloti];
var o = getObjectByStateSlot(state, slot);
if (o == null || !('modify' in o))
{
continue;
}
if ((mfname + '1') in o.modify)
{
mina += parseInt(o.modify[mfname + '1']);
maxa += parseInt(o.modify[mfname + '2']);
}
else if (mfname in o.modify)
{
mina += parseInt(o.modify[mfname]);
maxa += parseInt(o.modify[mfname]);
}
}
avgarmor1 += mina;
avgarmor2 += maxa;
state.results[mfname + '1'] = mina;
state.results[mfname + '2'] = maxa;
}
state.results.avgarmor1 = avgarmor1 / 4.0;
state.results.avgarmor2 = avgarmor2 / 4.0;
}
function processMagicDefence(target, mfname, value) {
if (mfname === 'magicdefence') {
target[mfname] += value;
for (var i in allElements) {
target[allElements[i] + 'magicdefence'] += value;
}
} else if (mfname === 'emagicdefence') {
target[mfname] += value;
if (isDarkLightElements) {
target.magicdefence += value;
schools = allElements;
} else {
schools = naturalElements;
}
for (var i in schools) {
target[schools[i] + 'magicdefence'] += value;
}
}
}
function processMagicPower(target, mfname, value) {
if (mfname === 'magicpower') {
target.magicpower += value;
var schools = isDarkLightElements ? allElements : naturalElements;
for (let i in schools) {
target[schools[i] + 'magicpower'] += value;
}
} else if (mfname === 'magiccommonpower') {
target.magicpower += value;
for (let i in allElements) {
target[allElements[i] + 'magicpower'] += value;
}
}
}
function changeModifier(state, makeUp, v)
{
switch (makeUp)
{
case 'edefence':
state.results.thrustdefence.all += v;
state.results.sabredefence.all += v;
state.results.crushdefence.all += v;
state.results.cutdefence.all += v;
break;
case 'magicdefence':
processMagicDefence(state.natural, 'magicdefence', v);
break;
case 'emagicdefence':
processMagicDefence(state.natural, 'emagicdefence', v);
break;
case 'magicpower':
processMagicPower(state.natural, 'magicpower', v);
break;
case 'magiccommonpower':
processMagicPower(state.natural, 'magiccommonpower', v);
break;
case 'endurance':
state.modify.hitpoints += (v * 6);
if (state.spellHitpoints != 0) {
state.modify.hitpoints += (v * state.spellHitpoints);
}
processMagicDefence(state.natural, 'emagicdefence', v * 1.5);
default:
if (makeUp in knownZoneModifiers) {
state.results[makeUp].all += v;
} else {
state.modify[makeUp] += v;
}
break;
}
}
function precalcZoneModifiers(state)
{
for (var mfname in knownZoneModifiers)
{
state.results[mfname] = {all: 0, head: 0, body: 0, waist: 0, leg: 0, avg: 0, pants: 0};
}
state.results.defence.all = (state.natural.endurance + state.modify.endurance) * 1.5;
}
function calcZoneModifiers(state)
{
for (var i = 0; i < slots.length; i++)
{
var slot = slots[i];
var o = getObjectByStateSlot(state, slot);
if (o == null)
{
continue;
}
if ('modify' in o)
{
for (var mfname in o.modify)
{
if (mfname in knownZoneModifiers)
{
state.results[mfname].all += parseInt(o.modify[mfname]);
}
}
}
if ('properties' in o)
{
for (var mfname in o.properties)
{
if (mfname in knownZoneModifiers)
{
state.results[mfname][slot.zone] += parseInt(o.properties[mfname]);
}
}
}
}
for (var i = 0; i < state.appliedSets.length; i++)
{
var set = state.appliedSets[i];
if ('modify' in set)
{
for (var mfname in set.modify)
{
if (mfname in knownZoneModifiers)
{
state.results[mfname].all += parseInt(set.modify[mfname]);
}
}
}
}
for (var i = 0; i < state.appliedStrengthenings.length; i++)
{
var strengthening = state.appliedStrengthenings[i];
if ('modify' in strengthening)
{
for (var mfname in strengthening.modify)
{
if (mfname in knownZoneModifiers)
{
state.results[mfname].all += parseInt(strengthening.modify[mfname]);
}
}
}
}
for (var delixn in state.defElixes)
{
var delix = knownDefElix[delixn];
if (!(delix.makeUp in knownZoneModifiers) && !(delix.makeUp == 'edefence'))
{
continue;
}
var v = state.defElixes[delixn];
changeModifier(state, delix.makeUp, v);
if ('makeUp2' in delix)
{
var v2 = getDefElixSecondValue(delix, v);
changeModifier(state, delix.makeUp2, v2);
}
}
if ('spell_protect10' in state.spellPowerUps)
{
state.results.defence.all += state.spellPowerUps.spell_protect10;
}
for (var delixn in state.damageElixes)
{
var delix = knownDamageElix[delixn];
if (!('modify' in delix)) continue;
if ('defence' in delix.modify) {
changeModifier(state, 'edefence', delix.modify.defence);
}
}
for (var mfname in knownZoneModifiers)
{
if (mfname == 'defence')
{
continue;
}
var zones = state.results[mfname];
zones.all += state.results.defence.all;
zones.head += state.results.defence.head;
zones.body += state.results.defence.body;
zones.waist += state.results.defence.waist;
zones.leg += state.results.defence.leg;
zones.pants += state.results.defence.pants;
}
for (var mfname in knownZoneModifiers)
{
var zones = state.results[mfname];
zones.head += zones.all;
zones.body += zones.all;
zones.waist += zones.all;
zones.leg += zones.all;
zones.waist += zones.pants;
zones.leg += zones.pants;
zones.avg = (zones.head + zones.body + zones.waist + zones.leg) / 4;
}
state.results.defence = {all: 0, head: 0, body: 0, waist: 0, leg: 0, avg: 0};
}
function recalcSpellPowerUpState(state)
{
for (var powerUp in knownPowerUps)
{
knownPowerUps[powerUp].found = false;
for (var sloti = 0; sloti < slots.length; sloti++)
{
var slot = slots[sloti];
var o = getObjectByStateSlot(state, slot);
knownPowerUps[powerUp].found |= (o != null && o.id == powerUp);
}
if (!knownPowerUps[powerUp].found)
{
continue;
}
var v = (2.2 * state.results[knownPowerUps[powerUp].skill] + 0.1 * state.natural.wisdom);
if (!knownPowerUps[powerUp].damageup)
{
v *= 2;
v /= 3;
}
var vself = v;
if (vself > 33)
{
vself = 33;
}
vself = Math.floor(vself * 100.0 + 0.5) / 100.0;
state.modify[powerUp + '_self'] = vself;
var vother = vself * 0.75;
vother = Math.floor(vother * 100.0 + 0.5) / 100.0;
state.modify[powerUp + '_other'] = vother;
}
}
function recalcDresserCombatTricksState(state)
{
state.combatTricks = {};
for (var i = 0; i < state.trickSlots.length; i++)
{
var trickn = state.trickSlots[i];
if (trickn == null)
{
continue;
}
state.combatTricks[trickn] = {};
}
for (var trickn in state.combatTricks)
{
var trick = tricks[trickn];
var skillv = 0;
var power = state.results.magicpower;
var manaconsumption = state.results.manaconsumption;
var element = '';
if (typeof (trick) == 'object' && ('required' in trick))
{
for (mfn in trick.required)
{
if (mfn.indexOf('magicskill') > 0)
{
skillv = state.results[mfn];
element = mfn.substr(0, mfn.indexOf('magicskill'));
power += state.results[element + 'magicpower'];
break;
}
}
}
if (element != '')
{
for (var powerupn in state.spellPowerUps)
{
var v = state.spellPowerUps[powerupn];
var kpu = knownPowerUps[powerupn];
if ((kpu == null) || !kpu.damageup || !('element' in kpu) || (kpu.element != element))
{
continue;
}
power += (v * 2.0 / 3.0);
break;
}
}
manaconsumption += (skillv * 0.72);
var r = state.combatTricks[trickn];
r.name = trick.name;
r.caption = trick.caption;
if ('consumes' in trick)
{
if ('mana' in trick.consumes)
{
var mana = trick.consumes.mana;
r.mana = Math.floor(mana * (1.0 - (manaconsumption / 100.0)) + 0.5);
}
if ('spiritlevel' in trick.consumes)
{
r.spiritlevel = trick.consumes.spiritlevel;
}
}
if ('attack' in trick)
{
if ('damage' in trick.attack)
{
r.mfdamage = Math.floor(trick.attack.damage * (1.0 + (power / 100.0)) + 0.5);
}
if ('mindamage' in trick.attack)
{
r.mindamage = Math.floor(trick.attack.mindamage * (1.0 + (power / 100.0)) + 0.5);
r.maxdamage = Math.floor(trick.attack.maxdamage * (1.0 + (power / 100.0)) + 0.5);
}
if ('nextdamage' in trick.attack)
{
r.nextdamage = Math.floor(trick.attack.nextdamage * (1.0 + (power / 100.0)) + 0.5);
r.nextturns = trick.attack.nextturns;
}
}
if ('healing' in trick)
{
if ('hitpoints' in trick.healing)
{
r.hitpoints = Math.floor(trick.healing.hitpoints * (1.0 + (power / 100.0)) + 0.5);
}
if ('minhitpoints' in trick.healing)
{
r.minhitpoints = Math.floor(trick.healing.minhitpoints * (1.0 + (power / 100.0)) + 0.5);
r.maxhitpoints = Math.floor(trick.healing.maxhitpoints * (1.0 + (power / 100.0)) + 0.5);
}
if ('nexthitpoints' in trick.healing)
{
r.nexthitpoints = Math.floor(trick.healing.nexthitpoints * (1.0 + (power / 100.0)) + 0.5);
r.nextturns = trick.healing.nextturns;
}
}
}
}
function applyCommonSkillsTo(chapter)
{
if ('weaponskill' in chapter)
{
for (var i = 0; i < knownWeaponSkills.length; i++)
{
var skilln = knownWeaponSkills[i];
if (skilln == 'staffskill')
{
continue;
}
if (!(skilln in chapter))
{
chapter[skilln] = 0;
}
chapter[skilln] += chapter.weaponskill;
}
chapter.weaponskill = 0;
}
if ('magicskill' in chapter)
{
for (var i = 0; i < naturalElements.length; i++)
{
var skilln = naturalElements[i] + 'magicskill';
if (!(skilln in chapter))
{
chapter[skilln] = 0;
}
chapter[skilln] += chapter.magicskill;
}
chapter.magicskill = 0;
}
/* if ('magicpower' in chapter)
{
for (var i = 0; i < allElements.length; i++)
{
var powern = allElements[i] + 'magicpower';
if (!(powern in chapter))
{
chapter[powern] = 0;
}
chapter[powern] += chapter.magicpower;
}
chapter.magicpower = 0;
}*/
}
function applyCommonSkills(state)
{
// applyCommonSkillsTo(state.natural);
applyCommonSkillsTo(state.modify);
applyCommonSkillsTo(state.results);
}
function isEmpty(obj) {
for (let key in obj) {
// если тело цикла начнет выполняться - значит в объекте есть свойства
return false;
}
return true;
}
function recalcDresserState(state)
{
var objid;
var o;
var propi;
var sloti;
var slot;
var set;
state.required = {};
state.modify = {};
state.results = {};
state.battlemf = {};
state.w3props = {};
state.w10props = {};
state.appliedSets = [];
state.appliedStrengthenings = [];
for (var mfname in item_props)
{
if (mfname in knownZoneModifiers)
{
continue;
}
if (!(mfname in state.natural))
{
state.natural[mfname] = 0;
}
if (!(mfname in state.modify))
{
state.modify[mfname] = 0;
}
}
state.natural.magicdefence = 0;
state.natural.emagicdefence = 0;
state.natural.magicpower = 0;
for (let i in allElements) {
state.natural[allElements[i] + 'magicdefence'] = 0;
state.natural[allElements[i] + 'magicpower'] = 0;
}
state.natural.hitpoints = (state.natural.endurance + state.modify.endurance) * 6;
state.natural.knapsack = 40*(state.natural.level + 1) + (state.natural.endurance + state.modify.endurance);
processMagicDefence(state.natural, 'magicdefence', (state.natural.endurance + state.modify.endurance) * 1.5);
state.natural.defence = ((state.natural.endurance + state.modify.endurance)* 1.5);
state.natural.mana = (state.natural.wisdom * 10);
state.natural.spiritlevel = 0;
var ls = state.natural.level;
state.natural.spiritlevel += ls >= 12 ? 50 : (ls == 11 ? 40 : Math.max((ls - 6) * 10, 0)); //need test for 1-6 levels
state.natural.counterstroke = 10;
state.natural.piercearmor = 0;
state.natural.attackcount = 1;
state.modify.attackcount = getAttackCount(state) - 1;
state.natural.blockcount = 2;
state.modify.blockcount = getBlockCount(state) - 2;
if ('spirituality' in state.natural)
{
state.natural.spiritlevel += state.natural.spirituality;
}
state.modify.knapsack = 0;
if (state.statElix != null)
{
var mf = knownElix[state.statElix.elixn].makeUp;
state.modify[mf] = state.statElix.v;
if ('makeUp2' in knownElix[state.statElix.elixn])
{
var mf2 = knownElix[state.statElix.elixn].makeUp2;
switch (mf2) {
case 'magicpower':
processMagicPower(state.natural, 'magicpower', knownElix[state.statElix.elixn].values2[0]);
break;
case 'magiccommonpower':
processMagicPower(state.natural, 'magiccommonpower', knownElix[state.statElix.elixn].values2[0]);
break;
case 'magicdefence':
processMagicDefence(state.natural, 'magicdefence', knownElix[state.statElix.elixn].values2[0]);
break;
case 'emagicdefence':
processMagicDefence(state.natural, 'emagicdefence', knownElix[state.statElix.elixn].values2[0]);
break;
default:
state.natural[mf2] += knownElix[state.statElix.elixn].values2[0];
}
}
}
if (state.spellIntel != 0)
{
state.modify.intellect = state.spellIntel + (('intellect' in state.modify) ? state.modify.intellect : 0);
}
if (state.spellBD != 0)
{
state.modify.strength = state.spellBD + (('strength' in state.modify) ? state.modify.strength : 0);
state.modify.dexterity = state.spellBD + (('dexterity' in state.modify) ? state.modify.dexterity : 0);
state.modify.intuition = state.spellBD + (('intuition' in state.modify) ? state.modify.intuition : 0);
state.modify.intellect = state.spellBD + (('intellect' in state.modify) ? state.modify.intellect : 0);
state.modify.hitpoints = state.spellBD*6 +(('hitpoints' in state.modify) ? state.modify.hitpoints : 0);
state.modify.mana = state.spellBD*10 +(('mana' in state.modify) ? state.modify.mana : 0);
}
if (state.spellHitpoints != 0)
{
state.modify.hitpoints = ((state.natural.endurance + state.modify.endurance) * state.spellHitpoints) + (('hitpoints' in state.modify) ? state.modify.hitpoints : 0);
}
var w3o = getObjectByStateSlot(state, slot_w3);
var w10o = getObjectByStateSlot(state, slot_w10);
//dressStrengthenings.neutralPower.modify.mindamage = state.natural.level;
//dressStrengthenings.neutralPower.modify.maxdamage = state.natural.level;
for (var setn in dressSets)
{
set = dressSets[setn];
var countFound = getCountForSet(state, set.id);
if (!('details' in set) || (countFound == 0))
{
continue;
}
for (var scn in set.details)
{
var sc = set.details[scn];
if ('required' in sc)
{
if ('itemscount' in sc.required)
{
if (!('caption' in sc))
{
sc.caption = set.caption + ' (<span style="color:green;">' + sc.required.itemscount + '</span>)';
}
if (sc.required.itemscount == countFound)
{
state.appliedSets.push(sc);
}
}
else if (('minitemscount' in sc.required) && ('maxitemscount' in sc.required))
{
if (!('caption' in sc))
{
sc.caption = set.caption + ' (<span style="color:green;">' + sc.required.minitemscount + ' - ' + sc.required.maxitemscount + '</span>)';
}
if ((countFound >= sc.required.minitemscount) && (countFound <= sc.required.maxitemscount))
{
state.appliedSets.push(sc);
}
}
}
}
}
for (sloti = 0; sloti < slots.length; sloti++)
{
slot = slots[sloti];
o = getObjectByStateSlot(state, slot);
if (o == null)
{
continue;
}
if ('required' in o)
{
for (var mfname in o.required)
{
if (mfname in knownZoneModifiers)
{
continue;
}
var v = parseInt(o.required[mfname]);
if (!(mfname in state.required) || (state.required[mfname] < v))
{
state.required[mfname] = v;
}
}
}
if ('modify' in o)
{
for (var mfname in o.modify)
{
if (mfname in knownZoneModifiers)
{
continue;
}
switch (mfname) {
case 'magicpower':
processMagicPower(state.modify, 'magicpower', parseInt(o.modify[mfname]));
break;
case 'magiccommonpower':
processMagicPower(state.modify, 'magiccommonpower', parseInt(o.modify[mfname]));
break;
case 'magicdefence':
processMagicDefence(state.modify, 'magicdefence', parseInt(o.modify[mfname]));
break;
case 'emagicdefence':
processMagicDefence(state.modify, 'emagicdefence', parseInt(o.modify[mfname]));
break;
default:
state.modify[mfname] += parseInt(o.modify[mfname]);
}
}
}
}
for (var tricki = 0; tricki < state.trickSlots.length; tricki++)
{
var trickn = state.trickSlots[tricki];
if (trickn == null)
{
continue;
}
o = tricks[getJSName(trickn)];
if (o == null)
{
continue;
}
if ('required' in o)
{
for (var mfname in o.required)
{
if (mfname in knownZoneModifiers)
{
continue;
}
var v = parseInt(o.required[mfname]);
if (!(mfname in state.required) || (state.required[mfname] < v))
{
state.required[mfname] = v;
}
}
}
}
for (var seti = 0; seti < state.appliedSets.length; seti++)
{
set = state.appliedSets[seti];
if ('required' in set)
{
for (var mfname in set.required)
{
if (mfname in knownZoneModifiers)
{
continue;
}
var v = parseInt(set.required[mfname]);
if (!(mfname in state.required) || (state.required[mfname] < v))
{
state.required[mfname] = v;
}
}
}
if ('modify' in set)
{
for (var mfname in set.modify)
{
if (mfname in knownZoneModifiers)
{
continue;
}
switch (mfname) {
case 'magicpower':
processMagicPower(state.modify, 'magicpower', parseInt(set.modify[mfname]));
break;
case 'magiccommonpower':
processMagicPower(state.modify, 'magiccommonpower', parseInt(set.modify[mfname]));
break;
case 'magicdefence':
processMagicDefence(state.modify, 'magicdefence', parseInt(set.modify[mfname]));
break;
case 'emagicdefence':
processMagicDefence(state.modify, 'emagicdefence', parseInt(set.modify[mfname]));
break;
default:
state.modify[mfname] += parseInt(set.modify[mfname]);
}
}
}
}
if (state.pet != null)
{
var pet = pets[state.pet.n];
var pl = pet.levels['L' + state.pet.level];
if ('skill' in pl)
{
if ('modify' in pl.skill)
{
for (var mfname in pl.skill.modify)
{
state.battlemf[mfname] = pl.skill.modify[mfname];
switch (mfname) {
case 'magicpower':
processMagicPower(state.modify, 'magicpower', pl.skill.modify[mfname]);
break;
case 'magiccommonpower':
processMagicPower(state.modify, 'magiccommonpower', pl.skill.modify[mfname]);
break;
case 'magicdefence':
processMagicDefence(state.modify, 'magicdefence', pl.skill.modify[mfname]);
break;
case 'emagicdefence':
processMagicDefence(state.modify, 'emagicdefence', pl.skill.modify[mfname]);
break;
default:
state.modify[mfname] += pl.skill.modify[mfname];
}
}
}
}
}
// preliminary results.
for (var powerupn in state.spellPowerUps)
{
if (powerupn in knownPowerUps)
{
var powerup = knownPowerUps[powerupn];
if ('element' in powerup) {
if (!powerup.damageup) {
state.natural[powerup.element + 'magicdefence'] += state.spellPowerUps[powerupn];
} else {
state.modify[powerup.element + 'magicpower'] += state.spellPowerUps[powerupn];
}
}
}
if (powerupn in knownECRPowerUps)
{
if (knownECRPowerUps[powerupn].modifyExt !== undefined) {
for (var epowerup in knownECRPowerUps[powerupn].modifyExt) {
// state.modify[epowerup] += knownECRPowerUps[powerupn].modifyExt[epowerup];
changeModifier(state, epowerup, knownECRPowerUps[powerupn].modifyExt[epowerup]);
}
} else {
var epowerup = knownECRPowerUps[powerupn];
if (!(epowerup.modify in knownZoneModifiers))
{
if (!(epowerup.modify in knownWeaponModifiersHash))
{
//state.modify[epowerup.modify] += epowerup.v;
changeModifier(state, epowerup.modify, epowerup.v);
}
}
}
}
}
calcResults(state);
state.natural.criticalhit = state.natural.anticriticalhit = (state.results.intuition * 5);
state.natural.jumpaway = state.natural.antijumpaway = (state.results.dexterity * 5);
state.natural.anticriticalpower = Math.floor(state.results.strength * 0.8);
// stupid fix for Legion Mountain buffs
for (var powerupn in state.spellPowerUps)
{
if (powerupn in knownECRPowerUps)
{
if (knownECRPowerUps[powerupn].modifyExt !== undefined) {
for (var epowerup in knownECRPowerUps[powerupn].modifyExt) {
if (['jumpaway', 'antijumpaway', 'criticalhit', 'anticriticalhit'].indexOf(epowerup) != -1) {
state.natural[epowerup] += knownECRPowerUps[powerupn].modifyExt[epowerup];
}
}
}
}
}
// stupid fix for Legion Mountain elixs
if (state.statElix != null)
{
if ('makeUp2' in knownElix[state.statElix.elixn])
{
var mf2 = knownElix[state.statElix.elixn].makeUp2;
if (['jumpaway', 'antijumpaway', 'criticalhit', 'anticriticalhit'].indexOf(mf2) != -1) {
state.natural[mf2] += knownElix[state.statElix.elixn].values2[0];
}
}
}
/* End of stupid fixes */
for (var delixn in state.damageElixes)
{
var delix = knownDamageElix[delixn];
if (!('modify' in delix)) continue;
if ('hitpoints' in delix.modify)
{
state.modify.hitpoints += delix.modify.hitpoints;
}
if ('mana' in delix.modify) {
state.modify.mana += delix.modify.mana;
}
if ('magicdefencereduce' in delix.modify) {
state.modify.magicdefencereduce += delix.modify.magicdefencereduce;
}
/* Another stupid fixes for ambra */
if ('antijumpaway' in delix.modify) {
state.natural.antijumpaway += delix.modify.antijumpaway;
}
if ('anticriticalhit' in delix.modify) {
state.natural.anticriticalhit += delix.modify.anticriticalhit;
}
if ('defence' in delix.modify) {
state.natural.defence += delix.modify.defence;
}
if ('magicdefence' in delix.modify) {
processMagicDefence(state.natural, 'magicdefence', delix.modify.magicdefence);
}
if ('emagicdefence' in delix.modify) {
processMagicDefence(state.natural, 'emagicdefence', delix.modify.emagicdefence);
}
if ('magicpower' in delix.modify) {
processMagicPower(state.natural, 'magicpower', delix.modify.magicpower);
}
if ('magiccommonpower' in delix.modify) {
processMagicPower(state.natural, 'magiccommonpower', delix.modify.magiccommonpower);
}
}
for (var strgn in dressStrengthenings)
{
var strg = dressStrengthenings[strgn];
if (strg.domain == 'com') continue;
var strgOk = true;
if ('required' in strg)
{
for (var mfname in strg.required)
{
var rvmin = parseInt(strg.required[mfname]);
var rvmax = (strg.step !== undefined) ? (rvmin + parseInt(strg.step)) : (rvmin + 24);
/*if (strgn == 'spirituality50')
{
rvmax = 99;
}*/
if (!(mfname in state.results) || (state.results[mfname] < rvmin) || ((rvmin < 250) && (state.results[mfname] > rvmax)))
{
strgOk = false;
break;
}
}
if (strgOk)
{
if ('zodiacs' in strg)
{
strgOk = false;
var zv = parseInt(state.sign);
if (!isNaN(zv) && (zv >= 1) && (zv <= 12))
{
for (var zn in strg.zodiacs)
{
var z = strg.zodiacs[zn];
if (zv == parseInt(z.value))
{
strgOk = true;
break;
}
}
}
}
}
}
if (strgOk)
{
state.appliedStrengthenings.push(strg);
}
}
for (propi = 0; propi < knownCleanModifiers.length; propi++)
{
var mfname = knownCleanModifiers[propi];
if (mfname == '-')
{
continue;
}
var mfvalue = (mfname in state.modify) ? state.modify[mfname] : 0;
for (var strgi = 0; strgi < state.appliedStrengthenings.length; strgi++)
{
var strg = state.appliedStrengthenings[strgi];
if (('modify' in strg) && (mfname in strg.modify))
{
switch (mfname) {
case 'magicpower':
processMagicPower(state.modify, 'magicpower', parseInt(strg.modify[mfname]));
break;
case 'magiccommonpower':
processMagicPower(state.modify, 'magiccommonpower', parseInt(strg.modify[mfname]));
break;
case 'magicdefence':
processMagicDefence(state.modify, 'magicdefence', parseInt(strg.modify[mfname]));
break;
case 'emagicdefence':
processMagicDefence(state.modify, 'emagicdefence', parseInt(strg.modify[mfname]));
break;
default:
mfvalue += parseInt(strg.modify[mfname]);
}
}
}
if (['magicpower', 'magiccommonpower', 'magicdefence', 'emagicdefence'].indexOf(mfname) === -1) {
state.modify[mfname] = mfvalue;
}
}
if ((w10o != null) && w10o.slot == slot_w10.id)
{
if (('properties' in w10o) && ('shieldblock' in w10o.properties))
{
state.modify.shieldblock += w10o.properties.shieldblock;
}
}
// final results
/*if ('strength' in state.modify)
{
state.modify.knapsack = (state.modify.strength * 4);
}
if ('strength' in state.battlemf)
{
state.modify.knapsack -= (state.battlemf.strength * 4);
}*/
state.natural.consumed_reward = (10000 * state.natural.pskil);
state.natural.consumed_reward += (2000 * state.natural.pstat) + (50 * (state.natural.pstat * (state.natural.pstat - 1)));
state.modify.consumed_reward = 0;
state.natural.totalstats = 0;
state.modify.totalstats = 0;
for (propi = 0; propi < knownStats.length; propi++)
{
var stname = knownStats[propi];
state.natural.totalstats += state.natural[stname];
state.modify.totalstats += state.modify[stname];
}
state.modify.totalprice = 0;
state.modify.totaleprice = 0;
state.modify.totalerprice = 0;
state.modify.totalweight = 0;
for (sloti = 0; sloti < slots.length; sloti++)
{
slot = slots[sloti];
o = getObjectByStateSlot(state, slot);
if (o == null || !('common' in o))
{
continue;
}
if ('price' in o.common)
{
state.modify.totalprice += o.common.price;
}
if ('eprice' in o.common)
{
state.modify.totaleprice += o.common.eprice;
}
if ('erprice' in o.common) {
state.modify.totalerprice += o.common.erprice;
}
if ('weight' in o.common)
{
state.modify.totalweight += o.common.weight;
}
else
{
state.modify.totalweight += 1;
}
}
state.modify.totalprice = Math.floor(state.modify.totalprice * 100.0 + 0.5) / 100.0;
state.modify.totaleprice = Math.floor(state.modify.totaleprice * 100.0 + 0.5) / 100.0;
state.modify.totalerprice = Math.floor(state.modify.totalerprice * 100.0 + 0.5) / 100.0;
state.modify.totalweight = Math.floor(state.modify.totalweight * 100.0 + 0.5) / 100.0;
var bothSkill = getWeaponSkillValue(state, slot_w3) + getWeaponSkillValue(state, slot_w10);
//state.natural.parry = (bothSkill * 0.5);
calcArmors(state);
precalcZoneModifiers(state);
for (var powerupn in state.spellPowerUps)
{
if (powerupn in knownECRPowerUps)
{
var epowerup = knownECRPowerUps[powerupn];
if (epowerup.modify in knownZoneModifiers)
{
state.results[epowerup.modify].head += epowerup.v;
state.results[epowerup.modify].body += epowerup.v;
state.results[epowerup.modify].waist += epowerup.v;
state.results[epowerup.modify].leg += epowerup.v;
state.results[epowerup.modify].avg += epowerup.v;
}
}
}
calcZoneModifiers(state);
recalcSpellPowerUpState(state);
for (var delixn in state.defElixes)
{
var delix = knownDefElix[delixn];
var v = state.defElixes[delixn];
changeModifier(state, delix.makeUp, v);
if ('makeUp2' in delix)
{
var v2 = getDefElixSecondValue(delix, v);
changeModifier(state, delix.makeUp2, v2);
}
}
processMagicPower(state.modify, 'magiccommonpower', Math.floor(((('intellect' in state.modify) ? state.modify.intellect : 0) + state.natural.intellect) * 0.5));
calcResults(state);
applyCommonSkills(state);
recalcDresserCombatSpellsState(state);
recalcDresserCombatTricksState(state);
calcResults(state);
state.w3props = recalcDresserWeaponState(state, slot_w3);
recalcDresserWeaponAdvState(state, slot_w3);
if (w10o != null && w10o.slot == slot_w3.id)
{
state.w10props = recalcDresserWeaponState(state, slot_w10);
recalcDresserWeaponAdvState(state, slot_w10);
}
}
function showInfoPane(state)
{
if (state == null)
{
state = activeState;
}
if (state == null)
{
return;
}
document.getElementById('infopane' + state.id).innerHTML = getDresserInfoPaneHtml(state);
}
// call when changes only in other cabs
function fastUpdateDresserState(state)
{
if (state == null)
{
return;
}
recalcDresserState(state);
showInfoPane(state);
updateDresserNaturalEditors(state);
showDressHint();
}
function updateDresserState(state)
{
if (state == null)
{
state = activeState;
}
if (state == null)
{
return;
}
//fastUpdateDresserState(state);
hardUpdateDresserState(state);
setMeter(state, hpMeterSuffix, state.results.hitpoints);
setMeter(state, manaMeterSuffix, ('mana' in state.results) ? state.results.mana : 0);
var nickelt = document.getElementById('nick' + state.id);
if (nickelt)
{
nickelt.innerHTML = getPersNickString(state);
}
}
function hardUpdateDresserState(state)
{
recalcDresserState(state);
document.getElementById('cab_' + state.id).innerHTML = getDresserInnerHtml(state);
}
var updateDresserStateWantedTimer = null;
function updateDresserStateWanted()
{
if (updateDresserStateWantedTimer != null)
{
clearTimeout(updateDresserStateWantedTimer);
updateDresserStateWantedTimer = null;
}
updateDresserStateWantedTimer = setTimeout("updateDresserState()", 300);
}
function preloadImages()
{
informAboutProgress(localizer.startPreloadImages);
var img = new Image(18, 16);
if (!('artefact' in imagesToBeLoaded))
{
img.src = baseImgPath + 'artefact.gif';
imagesToBeLoaded['artefact'] = img;
}
for (var catid in categories)
{
for (var j = 0; j < categories[catid].items.length; j++)
{
var item = categories[catid].items[j];
var jsName = getJSName(item.id);
if (!(jsName in imagesToBeLoaded))
{
img = new Image(item.width, item.height);
img.src = itemImgPath + item.id + '.gif';
imagesToBeLoaded[jsName] = img;
}
}
}
informAboutProgress(localizer.completePreloadImages);
}
var preloadImagesWantedTimer = null;
function preloadImagesWanted(state)
{
if (preloadImagesWantedTimer != null)
{
clearTimeout(preloadImagesWantedTimer);
preloadImagesWantedTimer = null;
}
preloadImagesWantedTimer = setTimeout('preloadImages()', preloadImagesDelay);
}
function getSlotById(slotid)
{
for (var i = 0; i < slots.length; i++)
{
if (slots[i].id == slotid)
{
return slots[i];
}
}
return null;
}
function getSlotByIndex(sloti)
{
for (var i = 0; i < slots.length; i++)
{
if (slots[i].index == sloti)
{
return slots[i];
}
}
return null;
}
function getObjectIdOfSlot(state, slotid)
{
return state.objects[getSlotById(slotid).index];
}
function hasTwohandledWeapon(state)
{
var w3o = getObjectByStateSlot(state, slot_w3);
return isTwohandledWeapon(w3o);
}
function DropAllScrolls(state)
{
for (var isScrollSlot = 100; isScrollSlot <= 109; isScrollSlot++)
{
setObjectForSlot(dressStates[state], 'w'+isScrollSlot, null);
}
}
function setObjectForSlot(state, slotid, objid)
{
var slot = getSlotById(slotid);
if (state == null || slot == null)
{
return;
}
var oimg = (objid == null) ? slotid : objid;
var o = getObjectById(objid);
var realItemImgPath = getRealImagePath(objid, slot);
// drop incompatible items.
if (slotid == 'w10' && objid != null && hasTwohandledWeapon(state))
{
onObjectDrop(state.id, 'w3');
}
if (slotid == 'w3' && objid != null && isTwohandledWeapon(o))
{
onObjectDrop(state.id, 'w10');
}
// dresser is fully rebuilt and transition applied later.
var imgElt = document.getElementById(state.id.toString() + slot.id);
var needRebuild = (imgElt == null);
if (slotid == 'w4')
{
// unfit armor if fitted before.
state.fitArmor = false;
}
state.fitSlots[slot.index] = null;
state.upgradeSlots[slot.index] = null;
state.charmSlots[slot.index] = null;
state.addSlots[slot.index] = null;
state.runeSlots[slot.index] = null;
if (slotid == 'w3')
{
state.w3sharp = 0;
}
if (slotid == 'w10')
{
state.w10sharp = 0;
}
state.objCache[slot.index] = null;
if (needRebuild)
{
document.getElementById('cab_' + state.id).innerHTML = getDresserInnerHtml(state);
}
state.objects[slot.index] = objid;
if ((o != null) && ('fakebase' in o))
{
state.upgradeSlots[slot.index] = objid + '_fake';
}
updateDresserSlot(state, slot);
}
function getFittedArmor(armorObject)
{
var fittedArmor = cloneObject(armorObject);
if (!('modify' in fittedArmor))
{
fittedArmor.modify = { hitpoints: 0 };
}
else if (!('hitpoints' in fittedArmor.modify))
{
fittedArmor.modify.hitpoints = 0;
}
var armorLevel = (('required' in fittedArmor) && ('level' in fittedArmor.required)) ? parseInt(fittedArmor.required.level) : 0;
fittedArmor.modify.hitpoints += ((armorLevel + 1) * 6);
fittedArmor.armorWasFit = true;
fittedArmor.destiny = 'Броня подогнана под персонажа';
return fittedArmor;
}
function getFittedObject(objectToFit, setIdToFit)
{
var fittedObject = cloneObject(objectToFit);
if (!('setlink' in fittedObject))
{
fittedObject.setlink = { name: setIdToFit };
}
else
{
fittedObject.setlink.name = setIdToFit;
}
fittedObject.wasFit = true;
/*if ('common' in fittedObject)
{
var upgradePrice = 0;
if ('eprice' in fittedObject.common)
{
upgradePrice = Math.floor(fittedObject.common.eprice * 20 + 0.5) / 100.0;
}
else if ('price' in fittedObject.common)
{
upgradePrice = Math.floor(fittedObject.common.price * 4 + 0.5) / 100.0;
}
if (upgradePrice > 0)
{
if ('eprice' in fittedObject.common)
{
fittedObject.common.eprice += upgradePrice;
}
else
{
fittedObject.common.eprice = upgradePrice;
}
}
}*/
return fittedObject;
}
function getCharmedObject(objectToCharm, modify)
{
var charmedObject = cloneObject(objectToCharm);
charmedObject.wasCharmed = true;
charmedObject.charms = modify;
if (!('modify' in charmedObject))
{
charmedObject.modify = {};
}
for (var mf in modify)
{
if (mf in charmedObject.modify)
{
charmedObject.modify[mf] = parseInt(charmedObject.modify[mf]) + modify[mf];
}
else
{
charmedObject.modify[mf] = modify[mf];
}
}
return charmedObject;
}
function getAddObject(objectToCharm, modify)
{
var charmedObject = cloneObject(objectToCharm);
charmedObject.wasAdded = true;
charmedObject.charms = modify;
if (!('modify' in charmedObject))
{
charmedObject.modify = {};
}
for (var mf in modify)
{
if (mf in charmedObject.modify)
{
charmedObject.modify[mf] = parseInt(charmedObject.modify[mf]) + modify[mf];
}
else
{
charmedObject.modify[mf] = modify[mf];
}
}
return charmedObject;
}
function getCharmedObject2(objectToCharm, charm)
{
var modify = {};
var ss = charm.split('#');
for (var i = 0; i < ss.length; i += 2)
{
var v = parseInt(ss[i + 1]);
if (!isNaN(v))
{
modify[ss[i]] = v;
}
}
return getCharmedObject(objectToCharm, modify);
}
function getAddObject2(objectToCharm, charm)
{
var modify = {};
var ss = charm.split('#');
for (var i = 0; i < ss.length; i += 2)
{
var v = parseInt(ss[i + 1]);
if (!isNaN(v))
{
modify[ss[i]] = v;
}
}
return getAddObject(objectToCharm, modify);
}
function getRunedObject(objectToRune, runeStr)
{
var appliedRune = '';
var appliedRuneOpt = '';
var ss = runeStr.split('#');
var v = parseInt(ss[1]);
if (!isNaN(v))
{
if (v < 1) { v = '0'; }
appliedRune=ss[0];
appliedRuneOpt=v;
}
var runedObject = cloneObject(objectToRune);
if (!appliedRune) { return runedObject; }
var o=getObjectById(appliedRune);
if (!('opts' in o.modify)) { return runedObject; }
if (o.modify.opts[appliedRuneOpt] == null) { return runedObject; }
runedObject.wasRuned = true;
runedObject.rune = appliedRune;
runedObject.runeOpt = appliedRuneOpt;
if (!('modify' in runedObject))
{
runedObject.modify = {};
}
var modify = o.modify.opts[appliedRuneOpt];
for (var mf in modify)
{
if (mf in runedObject.modify)
{
runedObject.modify[mf] = parseInt(runedObject.modify[mf]) + modify[mf];
}
else
{
runedObject.modify[mf] = modify[mf];
}
}
return runedObject;
}
function dropZeroInSection(o, sn)
{
if (!(sn in o)) return o;
for (var n in o[sn])
{
if (!isNaN(o[sn][n]) && o[sn][n] == 0) delete o[sn][n];
}
return o;
}
function getUpgradeObject(objectToUpgrade, upgradeIdToUpgrade)
{
if (!('upgradecache' in objectToUpgrade))
{
objectToUpgrade.upgradecache = {};
}
if (!(upgradeIdToUpgrade in objectToUpgrade.upgradecache))
{
var upgradeObject = {};
var upgrade = objectToUpgrade.upgrade[upgradeIdToUpgrade];
if ('fake' in upgrade)
{
upgrade.category = objectToUpgrade.category;
upgrade.slot = objectToUpgrade.slot;
upgrade.width = objectToUpgrade.width;
upgrade.height = objectToUpgrade.height;
upgradeObject = cloneObject(upgrade);
}
else
{
upgradeObject = cloneObject(objectToUpgrade);
upgradeObject = combineObjects(upgradeObject, upgrade);
upgradeObject = dropZeroInSection(upgradeObject, 'modify');
upgradeObject = dropZeroInSection(upgradeObject, 'properties');
upgradeObject = dropZeroInSection(upgradeObject, 'required');
}
upgradeObject.caption = getUpgradeCaption(objectToUpgrade, upgrade);
if ('price' in upgrade)
{
if (!('common' in upgradeObject))
{
upgradeObject.common = { eprice: 0 };
}
var oprice = ('eprice' in objectToUpgrade.common) ? objectToUpgrade.common.eprice : 0;
if ('level' in upgrade)
{
for (var oun in objectToUpgrade.upgrade)
{
var ou = objectToUpgrade.upgrade[oun];
var al = ('level' in ou) ? ou.level : 0;
if ((al < upgrade.level) && ('price' in ou))
{
oprice += ou.price;
}
}
}
oprice += upgrade.price;
upgradeObject.common.eprice = oprice;
}
upgradeObject.wasUpgrade = true;
objectToUpgrade.upgradecache[upgradeIdToUpgrade] = upgradeObject;
}
return objectToUpgrade.upgradecache[upgradeIdToUpgrade];
}
var sharpStatValues = {
strength: 0,
dexterity: 0,
intuition: 0,
endurance: 0,
intellect: 0,
wisdom: 0
};
var sharpStatsPriority = {
strength: 10,
dexterity: 8,
intuition: 6,
endurance: 4,
intellect: 2,
wisdom: 1
};
var sharpStats = [];
function compareSharpStats(x, y)
{
var r = sharpStatValues[x] - sharpStatValues[y];
if (r == 0)
{
r = sharpStatsPriority[x] - sharpStatsPriority[y];
}
return r;
}
function checkSharpeningAllowed(category, imp1, twohandled, sharp)
{
var result = true;
if (imp1 === true) {
result = ([6, 7, 8, 9, 11].indexOf(sharp) != -1);
} else {
if (category === 'staffs') {
result = (sharp === 5);
} else if (twohandled === true) {
result = ([1,2,3,4,5].indexOf(sharp) != -1);
} else {
result = ([1,2,3,4,5,7].indexOf(sharp) != -1);
}
}
return result;
}
function getSharpenWeapon(weaponObject, sharp)
{
if (sharp == 0 || weaponObject == null)
{
return weaponObject;
}
if (parseInt(sharp) == 11 || parseInt(sharp) == 8 || parseInt(sharp) == 6 || parseInt(sharp) == 9) { sharp=100+parseInt(sharp); }
var oldmode=1;
if (sharp > 100) { sharp-=100; oldmode = 0; }
// check allowed sharpering
if (!('category' in weaponObject) || !('properties' in weaponObject)) {
alert("Can't check sharpening is allowed!");
return weaponObject;
}
if (!checkSharpeningAllowed(weaponObject.category, ('imp1' in weaponObject && weaponObject.imp1 === true) || ('artefact' in weaponObject && weaponObject.artefact === true), 'twohandled' in weaponObject.properties, sharp)) {
alert("Sharpening is not allowed!");
return weaponObject;
}
var sharpenWeapon = cloneObject(weaponObject);
// drop sharpening for non-lv10 arts
//if (('artefact' in sharpenWeapon) && (oldmode != 1))
// {
// if ('required' in sharpenWeapon)
// {
// if ('level' in sharpenWeapon.required)
// {
// if (sharpenWeapon.required.level < 10 ) { return weaponObject; }
// }
// }
// }
var swcat = categories[sharpenWeapon.category];
var skillname = null;
if ('required' in sharpenWeapon)
{
for (var i = 0; i < knownWeaponSkills.length; i++)
{
if (knownWeaponSkills[i] in sharpenWeapon.required)
{
skillname = knownWeaponSkills[i];
break;
}
}
}
if (skillname == null && ('skillname' in swcat))
{
skillname = swcat.skillname;
}
// disable requirements increasing
/*var increaseReq = (skillname != null);
if (increaseReq && ('required' in weaponObject))
{
if ('multiplier' in weaponObject.required)
{
increaseReq = (weaponObject.required.multiplier != 0);
}
}
if (oldmode != 1) { increaseReq = false; }
if (increaseReq)
{
if (!('required' in sharpenWeapon))
{
sharpenWeapon.required = { strength: sharp, dexterity: sharp };
}
else
{
sharpStatValues = {
strength: ('strength' in sharpenWeapon.required) ? sharpenWeapon.required.strength : 0,
dexterity: ('dexterity' in sharpenWeapon.required) ? sharpenWeapon.required.dexterity : 0,
intuition: ('intuition' in sharpenWeapon.required) ? sharpenWeapon.required.intuition : 0,
endurance: ('endurance' in sharpenWeapon.required) ? sharpenWeapon.required.endurance : 0,
intellect: ('intellect' in sharpenWeapon.required) ? sharpenWeapon.required.intellect : 0,
wisdom: ('wisdom' in sharpenWeapon.required) ? sharpenWeapon.required.wisdom : 0
};
sharpStats = new Array('strength', 'dexterity', 'intuition', 'endurance', 'intellect', 'wisdom');
sharpStats.sort(compareSharpStats);
sharpStats.reverse();
sharpenWeapon.required[sharpStats[0]] = sharpStatValues[sharpStats[0]] + sharp;
sharpenWeapon.required[sharpStats[1]] = sharpStatValues[sharpStats[1]] + sharp;
}
if (skillname != 'staffskill')
{
var skillv = (skillname in sharpenWeapon.required) ? sharpenWeapon.required[skillname] : 0;
skillv += sharp;
sharpenWeapon.required[skillname] = skillv;
}
}*/
if (!('common' in sharpenWeapon))
{
sharpenWeapon.common = { price: 0 };
}
else
{
if (!('price' in sharpenWeapon.common))
{
sharpenWeapon.common.price = 0;
}
}
// disable requirements increasing
/*if (oldmode != 1) {
if (!('required' in sharpenWeapon))
{
sharpenWeapon.required = { level: 0 };
}
else
{
if (!('level' in sharpenWeapon.required))
{
sharpenWeapon.required.level=0;
}
}
if (sharpenWeapon.required.level < minSharpLevels[sharp]) { sharpenWeapon.required.level = minSharpLevels[sharp]; }
}*/
if (oldmode==1) {
if (sharp < 7) {
sharpenWeapon.common.price += 10 * Math.pow(2, sharp);
} else {
sharpenWeapon.common.price += (1000 * (sharp - 6));
}
} else {
if (('imp1' in sharpenWeapon && sharpenWeapon.imp1 === true) || ('artefact' in sharpenWeapon && sharpenWeapon.artefact === true)) {
if ('category' in sharpenWeapon && sharpenWeapon.category === 'staffs') {
sharpenWeapon.common.eprice += impReqMagSharpPrices[sharp];
} else {
sharpenWeapon.common.eprice += impRegSharpPrices[sharp];
}
} else if ('properties' in sharpenWeapon) {
if ('twohandled' in sharpenWeapon.properties) {
sharpenWeapon.common.price += dblSharpPrices[sharp];
} else {
sharpenWeapon.common.price += regSharpPrices[sharp];
}
} else {
sharpenWeapon.common.price += regSharpPrices[sharp];
}
}
var generalSharp=1;
if ('category' in sharpenWeapon)
{
if (sharpenWeapon.category == 'staffs') { generalSharp=0; }
}
if (generalSharp==1)
{
if (!('properties' in sharpenWeapon))
{
sharpenWeapon.properties = { mindamage: 0, maxdamage: 0 };
}
else
{
if (!('mindamage' in sharpenWeapon.properties))
{
sharpenWeapon.properties.mindamage = 0;
}
if (!('maxdamage' in sharpenWeapon.properties))
{
sharpenWeapon.properties.maxdamage = sharpenWeapon.properties.mindamage;
}
}
if ('properties' in sharpenWeapon)
{
if (('twohandled' in sharpenWeapon.properties) && (oldmode != 1))
{
sharpenWeapon.properties.mindamage += 2*sharp;
sharpenWeapon.properties.maxdamage += 2*sharp;
}
else
{
sharpenWeapon.properties.mindamage += sharp;
sharpenWeapon.properties.maxdamage += sharp;
}
}
}
else
{
if (!('modify' in sharpenWeapon))
{
sharpenWeapon.modify = { magicpower: 0 };
}
else
{
if (!('magicpower' in sharpenWeapon.modify))
{
sharpenWeapon.modify.magicpower = 0;
}
}
if (oldmode != 1) {
sharpenWeapon.modify.magicpower += sharp*2;
} else {
sharpenWeapon.modify.magicpower += sharp;
}
}
if (oldmode==1) { sharpenWeapon.caption += ' +' + sharp + '[old]'; }
else { sharpenWeapon.caption += ' +' + sharp; }
if ((sharp > 5 && oldmode == 1) || (oldmode != 1))
{
sharpenWeapon.destiny = 'Связано судьбой с персонажем, заточившим это оружие';
}
return sharpenWeapon;
}
function onObjectDrop(stateId, slotid)
{
setObjectForSlot(dressStates[stateId], slotid, null);
}
function onDropAll()
{
var state = activeState;
applyCleanItemsToState(state);
hardUpdateDresserState(state);
}
function onClearAllStats(stateId)
{
var state = dressStates[stateId];
clearAllStats(state);
updateDresserState(state);
}
function updateDresserSlot(state, slot)
{
state.objCache[slot.index] = null;
var o = getObjectById(state.objects[slot.index]);
var oimg = (o == null) ? slot.id : o.id;
var realItemImgPath = getRealImagePath(o != null ? o.id : null, slot);
var imgElt = document.getElementById(state.id.toString() + slot.id);
if (imgElt != null)
{
if (dressOptions.useTransitionEffects)
{
imgElt.filters['revealtrans'].apply();
}
imgElt.name = 'x' + oimg;
imgElt.src = format('{0}{1}.gif', realItemImgPath, oimg);
o = getObjectByStateSlot(state, slot);
var newFilter = getRealFilter(getObjectFilter(state, slot, o));
if (is.ie && newFilter != imgElt.style.filter)
{
imgElt.style.filter = newFilter;
}
if (dressOptions.useTransitionEffects)
{
imgElt.filters['revealtrans'].play();
}
}
updateDresserStateWanted();
}
function onFitArmor(stateId, fit)
{
var state = dressStates[stateId];
state.fitArmor = fit;
updateDresserSlot(state, slot_w4);
}
function onUnfitObject(stateId, slotId)
{
var state = dressStates[stateId];
var slot = getSlotById(slotId);
state.fitSlots[slot.index] = null;
updateDresserSlot(state, slot);
}
function onFitObject(stateId, slotId, setId)
{
var state = dressStates[stateId];
var slot = getSlotById(slotId);
if (state == null || slot == null)
{
return;
}
if (setId != null)
{
state.fitSlots[slot.index] = setId;
updateDresserSlot(state, slot);
}
else
{
var menuHtml ='<table width="260px" border="0">';
var o = getObjectByStateSlot(state, slot);
if (('wasFit' in o) && o.wasFit)
{
menuHtml += getRowMenuItemHtml(localizer.unfitObject, format("onUnfitObject('{0}', '{1}')", state.id, slot.id));
}
if ('setlinks' in o)
{
for (var seti = 1; seti < o.setlinks.length; seti++) // skip first
{
var set = dressSets[o.setlinks[seti]];
var sethtml = set.caption;
menuHtml += getRowMenuItemHtml(sethtml, format("onFitObject('{0}', '{1}', '{2}')", state.id, slot.id, set.id));
}
}
else
{
for (var setn in dressSets)
{
var set = dressSets[setn];
if (('noadjust' in set) && set.noadjust)
{
continue;
}
if (('virtual' in set) && set.virtual)
{
continue;
}
/*if (getSetItemsForSlot(set, slot).length > 0)
{
var sethtml = set.caption;
menuHtml += getRowMenuItemHtml(sethtml, format("onFitObject('{0}', '{1}', '{2}')", state.id, slot.id, set.id));
}*/
var sethtml = set.caption;
/* Emulation of the bug with Arrogance set fitting */
if ((['helmet208', 'staff900', 'staff901', 'staff902', 'staff903', 'gloves208', 'roba201'].indexOf(o.id) != -1) && (set.id != 'determination10')) {
continue;
}
menuHtml += getRowMenuItemHtml(sethtml, format("onFitObject('{0}', '{1}', '{2}')", state.id, slot.id, set.id));
}
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
showMenu(menuHtml);
}
}
function getUpgradeCaption(o, upgrade)
{
var caption = o.caption;
if ('caption' in upgrade)
{
caption = upgrade.caption;
}
if (('old' in upgrade) && upgrade.old)
{
caption = caption + ' [old]';
}
if ('level' in upgrade)
{
caption = caption + ' [' + upgrade.level + ']';
}
if ('fake' in upgrade)
{
caption = caption + ' [конструктор]';
}
return caption;
}
function onUpgradeObject(stateId, slotId, upgradeId)
{
var state = dressStates[stateId];
var slot = getSlotById(slotId);
if (state == null || slot == null)
{
return;
}
if (upgradeId != '')
{
state.upgradeSlots[slot.index] = upgradeId;
updateDresserSlot(state, slot);
}
else
{
var menuHtml ='<table width="260px" border="0">';
var o = getObjectById(state.objects[slot.index]);
menuHtml += getRowMenuItemHtml(localizer.noUpgrade, format("onUpgradeObject('{0}', '{1}', null)", state.id, slot.id));
for (var upgraden in o.upgrade)
{
var upgrade = o.upgrade[upgraden];
menuHtml += getRowMenuItemHtml(getUpgradeCaption(o, upgrade), format("onUpgradeObject('{0}', '{1}', '{2}')", state.id, slot.id, upgrade.id));
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
showMenu(menuHtml);
}
}
function onCharmObject(stateId, slotId)
{
var state = dressStates[stateId];
var slot = getSlotById(slotId);
if (state == null || slot == null)
{
return;
}
showMenu(getCharmChooserHtml(slot.index), false);
}
function onaddStats(stateId, slotId,numb)
{
var state = dressStates[stateId];
var slot = getSlotById(slotId);
onUnaddStats(stateId, slotId);
if (state == null || slot == null)
{
return;
}
showMenu(getASChooserHtml(slot.index,numb), false);
}
function doCharm(sloti)
{
var state = activeState;
var slot = getSlotByIndex(sloti);
hideMenu();
if (state == null || slot == null)
{
return;
}
var charm_mf_name = document.getElementById('charm_mf_name').value;
var charm_mf_value = document.getElementById('charm_mf_value').value;
//var charm_mf_replace = document.getElementById('charm_mf_replace').checked;
if (!(charm_mf_name in item_props) || isNaN(charm_mf_value) || parseInt(charm_mf_value) == 0)
{
return;
}
var v = charm_mf_name + '#' + parseInt(charm_mf_value);
/*if (state.charmSlots[slot.index] != null && !charm_mf_replace)
{
v += '#' + state.charmSlots[slot.index];
}*/
if (state.charmSlots[slot.index] != null && state.charmSlots[slot.index].indexOf('stats#') != -1) {
onUnaddStats(state.id, slot.id);
}
state.charmSlots[slot.index] = v;
updateDresserSlot(state, slot);
}
function doAddStats(sloti)
{
var state = activeState;
var slot = getSlotByIndex(sloti);
var statt = new Array('strength','dexterity','intuition','intellect');
hideMenu();
if (state == null || slot == null)
{
return;
}
var stat_add_strength = document.getElementById('add_strength').value;
var stat_add_dexterity = document.getElementById('add_dexterity').value;
var stat_add_intuition = document.getElementById('add_intuition').value;
var stat_add_intellect = document.getElementById('add_intellect').value;
for (i=0;i<statt.length;i++)
{
charm_mf_name = statt[i];
charm_mf_value = eval("stat_add_"+statt[i]);
if (charm_mf_value != 0){
if (!(charm_mf_name in item_props) || isNaN(charm_mf_value))
{
return;
}
var v = charm_mf_name + '#' + parseInt(charm_mf_value);
if (state.addSlots[slot.index] != null)
{
v += '#' + state.addSlots[slot.index];
}
state.addSlots[slot.index] = v;
updateDresserSlot(state, slot);
}
}
}
function doPredefinedCharm(sloti, v)
{
var state = activeState;
var slot = getSlotByIndex(sloti);
hideMenu();
if (state == null || slot == null)
{
return;
}
/* var charm_mf_replace = document.getElementById('charm_mf_replace').checked;
if (state.charmSlots[slot.index] != null && !charm_mf_replace)
{
v += '#' + state.charmSlots[slot.index];
}*/
state.charmSlots[slot.index] = v;
updateDresserSlot(state, slot);
}
function onUncharmObject(stateId, slotId)
{
var state = dressStates[stateId];
var slot = getSlotById(slotId);
if (state == null || slot == null)
{
return;
}
if (state.charmSlots[slot.index] != null && state.charmSlots[slot.index].indexOf('stats#') != -1) {
onUnaddStats(stateId, slotId);
}
state.charmSlots[slot.index] = null;
updateDresserSlot(state, slot);
}
function onUnaddStats(stateId, slotId)
{
var state = dressStates[stateId];
var slot = getSlotById(slotId);
if (state == null || slot == null)
{
return;
}
state.addSlots[slot.index] = null;
updateDresserSlot(state, slot);
}
function onUnRuneObject(stateId, slotId)
{
var state = dressStates[stateId];
var slot = getSlotById(slotId);
if (state == null || slot == null)
{
return;
}
state.runeSlots[slot.index] = null;
updateDresserSlot(state, slot);
}
function onSharpWeapon(stateId, slotId, sharp)
{
if (parseInt(sharp) == 11 || parseInt(sharp) == 8 || parseInt(sharp) == 6 || parseInt(sharp) == 9) { sharp=100+parseInt(sharp); }
var state = dressStates[stateId];
var slot = getSlotById(slotId);
if (state == null || slot == null)
{
return;
}
if (slot.id == 'w3')
{
state.w3sharp = parseInt(sharp);
}
if (slot.id == 'w10')
{
state.w10sharp = parseInt(sharp);
}
updateDresserSlot(state, slot);
}
function getSetItemsForSlot(set, slot)
{
var setid = set.id;
var r = [];
for (var catid in categories)
{
var cat = categories[catid];
if (cat.slot != slot.id)
{
continue;
}
for (var itemIndex = 0; itemIndex < cat.items.length; itemIndex++)
{
var item = cat.items[itemIndex];
if ('baseitem' in item)
{
continue;
}
if (('setlink' in item) && (item.setlink.name == setid))
{
r.push(item);
}
}
}
return r;
}
function getObjectsCountOfVariant(v)
{
var r = 0;
for (var i = 0; i < v.length; i++)
{
if (v[i] != null)
{
r++;
// fix for twohandled weapons and staffs (only haughtiness)
if ('properties' in v[i]) {
let o = v[i];
if (('twohandled' in o.properties) && (o.properties.twohandled === 'yes')
&& ('setlink' in o) && ('name' in o.setlink) && (o.setlink.name === 'haughtiness'))
{
r++;
}
}
}
}
return r;
}
function pushVariantIfNotExists(r, v)
{
var nv = v.concat([]);
// exclude w10 if w3 twohandled
var w3o = nv[slot_w3.index];
var w10o = nv[slot_w10.index];
if ((w10o != null) && isTwohandledWeapon(w3o))
{
nv[slot_w10.index] = null;
w10o = null;
}
for (var i = 0; i < r.length; i++)
{
var different = false;
for (var j = 0; j < r[i].length; j++)
{
if (r[i][j] != nv[j])
{
different = true;
break;
}
}
if (!different)
{
return;
}
}
r.push(nv);
}
function getCaptionOfVariant(v, variants)
{
var cap = localizer.setEtc;
for (var i = slots.length - 1; i >= 0; i--)
{
var slot = slots[i];
if (v[slot.index] != null)
{
if (variants[slot.index].length > 1)
{
cap = v[slot.index].caption + ' + ' + cap;
}
}
}
return cap;
}
function getSetVariant(set, slotIndexes)
{
var v = new Array(slots.length);
var sv = getSetVariants(set);
for (var sloti = 0; sloti < slots.length; sloti++)
{
var slot = slots[sloti];
if (slotIndexes[sloti] != null && slotIndexes[sloti] < sv[slot.index].length)
{
v[slot.index] = sv[slot.index][slotIndexes[sloti]];
}
}
return v;
}
function pushPopulatedSetVariantsR(r, set, slotIndexes, currentIndex)
{
if (currentIndex >= slots.length)
{
return;
}
var slot = slots[currentIndex];
var sv = getSetVariants(set);
if (sv[slot.index].length == 0)
{
pushPopulatedSetVariantsR(r, set, slotIndexes, currentIndex + 1);
}
else
{
for (slotIndexes[currentIndex] = 0; slotIndexes[currentIndex] < sv[slot.index].length; slotIndexes[currentIndex] += 1)
{
pushPopulatedSetVariantsR(r, set, slotIndexes, currentIndex + 1);
var v = getSetVariant(set, slotIndexes);
if (getObjectsCountOfVariant(v) >= set.count)
{
pushVariantIfNotExists(r, v);
}
}
}
}
function getPopulatedSetVariants(set)
{
if ('pvariants' in set)
{
return set.pvariants;
}
showMenu(localizer.pleaseWait);
var r = [];
var slotIndexes = new Array(slots.length);
pushPopulatedSetVariantsR(r, set, slotIndexes, 0);
set.pvariants = r;
hideMenu();
return r;
}
function compareSets(x, y)
{
if (x == y)
{
return 0;
}
if (x == null)
{
return -1;
}
if (y == null)
{
return 1;
}
var xlvl = (('required' in x) && ('level' in x.required)) ? parseInt(x.required.level) : 0;
var ylvl = (('required' in y) && ('level' in y.required)) ? parseInt(y.required.level) : 0;
if (xlvl != ylvl)
{
return (xlvl - ylvl);
}
if (x.caption != y.caption)
{
return (x.caption < y.caption) ? -1 : 1;
}
return 0;
}
function onDressAnyCombatsSet()
{
cursorX -= 400;
if ('dressAnyCombatsSet' in menuhash)
{
showMenu(menuhash.dressAnyCombatsSet);
return;
}
var menuHtml ='<table width="780" cellspacing="0" cellpadding="0" border="0">';
var state = activeState;
if (state == null)
{
return;
}
var usets8 = [];
var usets9 = [];
var usets10 = [];
var isets = [];
var vsets = [];
for (var setn in dressSets)
{
var set = dressSets[setn];
if (('virtual' in set) && set.virtual)
{
vsets.push(set);
}
else
{
if (('imp1' in set) && set.imp1)
{
isets.push(set);
}
else
{
if (set.required.level <= 8) { usets8.push(set); }
if (set.required.level == 9) { usets9.push(set); }
if (set.required.level > 9) { usets10.push(set); }
}
}
}
usets8.sort(compareSets);
usets9.sort(compareSets);
usets10.sort(compareSets);
isets.sort(compareSets);
vsets.sort(compareSets);
menuHtml += '<tr><td valign="top"><table width="260" cellspacing="0" cellpadding="0" border="0">';
for (var setn in usets8)
{
var set = usets8[setn];
var sethtml = set.caption;
menuHtml += getRowMenuItemHtml(sethtml, format("onDressCombatsSet('{0}')", set.id));
}
menuHtml += getRowMenuSeparatorHtml();
for (var setn in isets)
{
var set = isets[setn];
var sethtml = set.caption;
menuHtml += getRowMenuItemHtml(sethtml, format("onDressCombatsSet('{0}')", set.id));
}
menuHtml += '</table></td><td valign="top"><table width="260" cellspacing="0" cellpadding="0" border="0">';
for (var setn in usets9)
{
var set = usets9[setn];
var sethtml = set.caption;
menuHtml += getRowMenuItemHtml(sethtml, format("onDressCombatsSet('{0}')", set.id));
}
menuHtml += '</table></td><td valign="top"><table width="260" cellspacing="0" cellpadding="0" border="0">';
for (var setn in usets10)
{
var set = usets10[setn];
var sethtml = set.caption;
menuHtml += getRowMenuItemHtml(sethtml, format("onDressCombatsSet('{0}')", set.id));
}
menuHtml += getRowMenuSeparatorHtml();
for (var setn in vsets)
{
var set = vsets[setn];
var sethtml = set.caption;
menuHtml += getRowMenuItemHtml(sethtml, format("onDressCombatsSet('{0}')", set.id));
}
menuHtml += '</table></td></tr>';
menuHtml += '<tr><td colspan="3"><table width="780" cellspacing="0" cellpadding="0" border="0">';
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table></td></tr></table>';
menuhash.dressAnyCombatsSet = menuHtml;
showMenu(menuHtml);
}
function dressSetVariant(state, setVariant)
{
for (var i = slots.length - 1; i >= 0; i--)
{
var slot = slots[i];
if (setVariant[slot.index] != null)
{
setObjectForSlot(state, slot.id, setVariant[slot.index].id);
}
}
}
function onDressCombatsSet(setId, setVariantIndex)
{
if (setId.indexOf("10") == -1)
{
var VsetId=setId;
var addtl="";
}
else
{
var LastPos=setId.indexOf("10");
var VsetId=setId.substr(0, LastPos);
var addtl=" [10]";
}
var state = activeState;
var set = getSetById(VsetId);
if (state == null || set == null)
{
return;
}
var variants = getPopulatedSetVariants(set);
if (variants.length == 0)
{
return;
}
if (setVariantIndex == null && variants.length == 1)
{
dressSetVariant(state, variants[0]);
// insert upgrade function here
if (setId.indexOf("10") != -1) { UpgradeSet(state, setId); }
return;
}
if (setVariantIndex != null)
{
dressSetVariant(state, variants[parseInt(setVariantIndex)]);
// insert upgrade function here
if (setId.indexOf("10") != -1) { UpgradeSet(state, setId); }
return;
}
var menuHtml ='<table width="360px" border="0">';
menuHtml += set.caption.bold() + addtl.bold() +'<br /><center>';
for (var vi = 0; vi < variants.length; vi++)
{
var v = variants[vi];
menuHtml += getRowMenuItemHtml(getCaptionOfVariant(v, getSetVariants(set)), format("onDressCombatsSet('{0}', {1})", setId, vi));
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
showMenu(menuHtml);
}
function UpgradeSet(state, setId)
{
var batslots=new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,19);
for (i=0; i<batslots.length; i++)
{
var slotId='w'+batslots[i];
var slot = getSlotById(slotId);
var o = getObjectById(state.objects[slot.index]);
if ((o != null) && ('upgrade' in o))
{
for (var upgraden in o.upgrade)
{
var upgrade = o.upgrade[upgraden];
if ('setlink' in upgrade && upgrade.setlink.name == setId)
{
onUpgradeObject(state.id, slot.id, upgrade.id);
}
}
}
}
}
function itemCompare(x, y)
{
if (x == y)
{
return 0;
}
if (x == null)
{
return -1;
}
if (y == null)
{
return 1;
}
var xeprice = !(('imp1' in x) && x.imp1) && (('common' in x) && ('eprice' in x.common)) ? parseInt(x.common.eprice) : 0;
var yeprice = !(('imp1' in y) && y.imp1) && (('common' in y) && ('eprice' in y.common)) ? parseInt(y.common.eprice) : 0;
if (xeprice != yeprice)
{
return (xeprice - yeprice);
}
var xlvl = (('required' in x) && ('level' in x.required)) ? parseInt(x.required.level) : 0;
var ylvl = (('required' in y) && ('level' in y.required)) ? parseInt(y.required.level) : 0;
if (xlvl != ylvl)
{
return (xlvl - ylvl);
}
var xprice = (('common' in x) && ('price' in x.common)) ? parseInt(x.common.price) : 0;
var yprice = (('common' in y) && ('price' in y.common)) ? parseInt(y.common.price) : 0;
if (xprice != yprice)
{
return (xprice - yprice);
}
if (x.caption != y.caption)
{
return (x.caption < y.caption) ? -1 : 1;
}
return 0;
}
function getFilteredItems(items)
{
var r = [];
var prop = null;
if (dressOptions.ffiltermf != null)
{
var propIndex = dressOptions.ffiltermf;
var propList = item_props;
for (mfn in propList)
{
propIndex--;
if (propIndex == 0)
{
prop = mfn;
break;
}
}
}
for (var i = 0; i < items.length; i++)
{
var itm = items[i];
if (itm == null)
{
continue;
}
// exclude items that interpreted as upgrades.
if ('baseitem' in itm)
{
continue;
}
// exclude old items
if (!dressOptions.fshowold && ('old' in itm) && itm.old)
{
continue;
}
if (!dressOptions.fshow_com && ('imp1' in itm) && itm.imp1 && !('artefact' in itm))
{
continue;
}
if (!dressOptions.fshow_ru && (!(('imp1' in itm) && itm.imp1)) && !('artefact' in itm))
{
continue;
}
if (!dressOptions.fshow_artefacts && ('artefact' in itm) && itm.artefact)
{
continue;
}
if (dressOptions.frewardonly)
{
if (!('requireditems' in itm)) continue;
if (!(('s_luka' in itm.requireditems) || ('luka' in itm.requireditems))) continue;
}
var itemLevel1 = ('required' in itm) && ('level' in itm.required) ? parseInt(itm.required.level) : null;
var itemLevel2 = itemLevel1;
if ('upgrade' in itm)
{
for (var upn in itm.upgrade)
{
var u = itm.upgrade[upn];
var itemLevelUp = ('required' in u) && ('level' in u.required) ? parseInt(u.required.level) : null;
if (itemLevelUp == null) continue;
if (itemLevel1 > itemLevelUp) itemLevel1 = itemLevelUp;
if (itemLevel2 < itemLevelUp) itemLevel2 = itemLevelUp;
}
}
if (itemLevel1 != null)
{
if (dressOptions.fmaxlevel != null)
{
if (itemLevel1 > dressOptions.fmaxlevel)
{
continue;
}
}
}
if (dressOptions.fminlevel != null)
{
if ((itemLevel2 == null) || itemLevel2 < dressOptions.fminlevel)
{
continue;
}
}
if (prop != null)
{
var propFound = ('modify'in itm) && (prop in itm.modify) && (itm.modify[prop] > 0);
if (!propFound) propFound = ('properties'in itm) && (prop in itm.properties) && (itm.properties[prop] > 0);
if (!propFound)
{
continue;
}
}
r.push(items[i]);
}
r.sort(itemCompare);
return r;
}
function enableCategoryItems()
{
var filterWindow = document.getElementById('filterWindow');
var itemsView = document.getElementById('itemsView');
if (filterWindow == null)
{
return;
}
filterWindow.innerHTML = '';
filterWindow.style.visibility = 'hidden';
if (is.ie && itemsView.filters)
{
itemsView.filters[0].Enabled = false;
itemsView.filters[1].Enabled = false;
}
else
{
itemsView.style.backgroundColor = '';
}
reshowMenu();
}
function applyFilter2()
{
applyFilter3();
enableCategoryItems();
}
function applyFilter3()
{
var filterWindow = document.getElementById('filterWindow');
storeFilterDialog();
filterDialogProps.fminlevel = parseInt(filterDialogProps.fminlevel);
filterDialogProps.fmaxlevel = parseInt(filterDialogProps.fmaxlevel);
if (isNaN(filterDialogProps.fminlevel) || (filterDialogProps.fminlevel < 0) || (filterDialogProps.fminlevel > 21))
{
filterDialogProps.fminlevel = null;
}
if (isNaN(filterDialogProps.fmaxlevel) || (filterDialogProps.fmaxlevel < 0) || (filterDialogProps.fmaxlevel > 21))
{
filterDialogProps.fmaxlevel = null;
}
if ((filterDialogProps.fminlevel != null) && (filterDialogProps.fmaxlevel != null) && (filterDialogProps.fmaxlevel < filterDialogProps.fminlevel))
{
var tempv = filterDialogProps.fminlevel;
filterDialogProps.fminlevel = filterDialogProps.fmaxlevel;
filterDialogProps.fmaxlevel = tempv;
}
if (isNaN(filterDialogProps.ffiltermf) || (filterDialogProps.ffiltermf == 0))
{
filterDialogProps.ffiltermf = null;
}
filterWindow.innerHTML = '';
dressOptions.fminlevel = filterDialogProps.fminlevel;
dressOptions.fmaxlevel = filterDialogProps.fmaxlevel;
dressOptions.fshowold = filterDialogProps.fshowold;
dressOptions.fshow_com = filterDialogProps.fshow_com;
dressOptions.fshow_ru = filterDialogProps.fshow_ru;
dressOptions.fshow_artefacts = filterDialogProps.fshow_artefacts;
dressOptions.ffiltermf = filterDialogProps.ffiltermf;
dressOptions.frewardonly = filterDialogProps.frewardonly;
setupFilterFialog();
applyItemsToCategoryView();
showCurrentFilter();
saveOptions();
}
function onSetInlineFilter()
{
var filterWindow = document.getElementById('filterWindow');
var itemsView = document.getElementById('itemsView');
if (filterWindow == null)
{
return;
}
if (is.ie && itemsView.filters)
{
itemsView.filters[0].Enabled = true;
itemsView.filters[1].Enabled = true;
}
else
{
itemsView.style.backgroundColor = '#E2E0E0';
}
showCurrentFilter();
filterWindow.style.visibility = 'visible';
reshowMenu(false);
}
function getFilterHash()
{
var r = 'hash.';
r += dressOptions.fminlevel;
r += '.';
r += dressOptions.fmaxlevel;
r += '.';
r += dressOptions.fshowold;
r += '.';
r += dressOptions.fshow_com;
r += '.';
r += dressOptions.fshow_ru;
r += '.';
r += dressOptions.fshow_artefacts;
r += '.';
r += dressOptions.ffiltermf;
r += '.';
r += dressOptions.frewardonly;
return r;
}
function onResetInlineFilter()
{
var filterWindow = document.getElementById('filterWindow');
filterWindow.innerHTML = '';
dressOptions.fminlevel = null;
dressOptions.fmaxlevel = null;
dressOptions.fshowold = false;
dressOptions.fshow_com = true;
dressOptions.fshow_ru = true;
dressOptions.fshow_artefacts = true;
dressOptions.ffiltermf = null;
dressOptions.frewardonly = false;
setupFilterFialog();
applyItemsToCategoryView();
enableCategoryItems();
saveOptions();
}
function getDresserFilterTabHtml(tabText, tabFunc, on)
{
var html = '';
var classn = on ? 'activeLink' : 'usualLink';
var onclick = on ? '' : (' onclick="' + tabFunc + '"');
html += format('<li class="{0}"><a href="javascript:;"{1}>{2}</li>', classn, onclick, tabText);
return html;
}
function getDresserFilterTabsHtml(tabIndex)
{
var windowWidth = (8 * 60) - 8;
var html = '';
html += '<div class="dtab"><ul class="dtab">';
html += getDresserInfoPaneTabHtml(localizer.filterGeneralTab, 'showCommonFilter()', (tabIndex == 0));
html += getDresserInfoPaneTabHtml(localizer.filterMfTab, 'showMfFilter()', (tabIndex == 1));
// html += getDresserInfoPaneTabHtml(localizer.filterSortTab, 'showItemSort()', (tabIndex == 2));
html += '</ul></div>';
return html;
}
function getFilterHeaderHtml()
{
var windowWidth = (8 * 60) - 8;
var html = '';
html += '<div style="width: ' + windowWidth + 'px; padding: 2px 2px 2px 2px;">';
windowWidth -= 4;
html += format(localizer.filter, clanImgPath);
html += getDresserFilterTabsHtml(dressOptions.currentFilterTab);
html += '<table width="' + windowWidth + '" border="0" cellspacing="0" cellpadding="0" class="tab-content"><tr><td colspan="2">';
html += '<table width="100%" border="0" cellspacing="0" class="tcontent" style="padding: 2px 8px 0px 0px;">';
html += '<tr><td>';
return html;
}
function getFilterFooterHtml()
{
var html = '';
html += '</td></tr>';
html += '</table>';
html += '</td></tr>';
html += '</table>';
html += '</td></tr></table>';
html += ' <input class="inpButton" type="button" value=" OK " onclick="applyFilter2()" />';
html += ' <input class="inpButton" type="button" value="' + localizer.apply + '" onclick="applyFilter3()" />';
html += ' <input class="inpButton" type="button" value="' + localizer.cancel + '" onclick="enableCategoryItems()" />';
html += '</div>';
return html;
}
function setupFilterFialog()
{
filterDialogProps = {
fminlevel: dressOptions.fminlevel,
fmaxlevel: dressOptions.fmaxlevel,
fshowold: dressOptions.fshowold,
fshow_com: dressOptions.fshow_com,
fshow_ru: dressOptions.fshow_ru,
fshow_artefacts: dressOptions.fshow_artefacts,
ffiltermf: dressOptions.ffiltermf,
frewardonly: dressOptions.frewardonly
};
}
function storeFilterDialog()
{
var fminlevel = document.getElementById('fminlevel');
if (fminlevel != null)
{
filterDialogProps.fminlevel = fminlevel.value;
}
var fmaxlevel = document.getElementById('fmaxlevel');
if (fmaxlevel != null)
{
filterDialogProps.fmaxlevel = fmaxlevel.value;
}
var fshowold = document.getElementById('fshowold');
if (fshowold != null)
{
filterDialogProps.fshowold = fshowold.checked;
}
var fshow_com = document.getElementById('fshow_com');
if (fshow_com != null)
{
filterDialogProps.fshow_com = fshow_com.checked;
}
var fshow_ru = document.getElementById('fshow_ru');
if (fshow_ru != null)
{
filterDialogProps.fshow_ru = fshow_ru.checked;
}
var fshow_artefacts = document.getElementById('fshow_artefacts');
if (fshow_artefacts != null)
{
filterDialogProps.fshow_artefacts = fshow_artefacts.checked;
}
var ffiltermf = document.getElementById('ffiltermf');
if (ffiltermf != null)
{
filterDialogProps.ffiltermf = ffiltermf.value;
}
var frewardonly = document.getElementById('frewardonly');
if (frewardonly != null)
{
filterDialogProps.frewardonly = frewardonly.checked;
}
}
function getCommonFilterHtml()
{
var html = '';
html += getFilterHeaderHtml();
html += format('<label for="fminlevel">{1}: </label><input id="fminlevel" name="fminlevel" type="text" value="{0}" class="ABText80" />', (filterDialogProps.fminlevel != null) ? filterDialogProps.fminlevel : '', localizer.fminlevel);
html += '<br />';
html += format('<label for="fmaxlevel">{1}: </label><input id="fmaxlevel" name="fmaxlevel" type="text" value="{0}" class="ABText80" />', (filterDialogProps.fmaxlevel != null) ? filterDialogProps.fmaxlevel : '', localizer.fmaxlevel);
html += '<hr class="dashed" />';
html += ' <input id="fshowold" name="fshowold" type="checkbox" value="showold"' + (filterDialogProps.fshowold ? 'checked="yes"' : '') + ' /><label for="fshowold"> ' + localizer.fshowold + '</label>';
html += ' <input id="fshow_com" name="fshow_com" type="checkbox" value="show_com"' + (filterDialogProps.fshow_com ? 'checked="yes"' : '') + ' /><label for="fshow_com"> ' + localizer.fshow_com + '</label>';
html += ' <input id="fshow_ru" name="fshow_ru" type="checkbox" value="show_ru"' + (filterDialogProps.fshow_ru ? 'checked="yes"' : '') + ' /><label for="fshow_ru"> ' + localizer.fshow_ru + '</label>';
html += ' <input id="fshow_artefacts" name="fshow_artefacts" type="checkbox" value="show_artefacts"' + (filterDialogProps.fshow_artefacts ? 'checked="yes"' : '') + ' /><label for="fshow_artefacts"> ' + localizer.fshow_artefacts + '</label>';
html += '<br /><input id="frewardonly" name="frewardonly" type="checkbox" value="frewardonly"' + (filterDialogProps.frewardonly ? 'checked="yes"' : '') + ' /><label for="frewardonly"> ' + localizer.frewardonly + '</label>';
html += getFilterFooterHtml();
return html;
}
function showCommonFilter()
{
dressOptions.currentFilterTab = 0;
storeFilterDialog();
var filterWindow = document.getElementById('filterWindow');
filterWindow.innerHTML = getCommonFilterHtml();
}
function getMfFilterHtml()
{
var mfi = 0;
var html = '';
html += getFilterHeaderHtml();
html += format('<label for="ffiltermf">{0}: </label><br /><select id="ffiltermf" name="ffiltermf">', localizer.ffiltermf);
html += '<option value="0"' + ((filterDialogProps.ffiltermf == null || filterDialogProps.ffiltermf == 0) ? ' selected="yes"' : '') + '>' + localizer.noFilterMf + '</option>';
mfi = 0;
for (var mfn in item_props)
{
var prop = item_props[mfn];
mfi++;
if (!('inprpg' in prop) && !('inmfg' in prop))
{
continue;
}
html += '<option value="' + mfi + '"' + ((filterDialogProps.ffiltermf == mfi) ? ' selected="yes"' : '') + '>' + prop.lbl + '</option>';
}
html += '</select><br />';
html += localizer.ffiltermfHint;
html += getFilterFooterHtml();
return html;
}
function showMfFilter()
{
dressOptions.currentFilterTab = 1;
storeFilterDialog();
var filterWindow = document.getElementById('filterWindow');
filterWindow.innerHTML = getMfFilterHtml();
}
function getItemSortHtml()
{
var html = '';
html += getFilterHeaderHtml();
html += 'Пока не реализовано.';
html += getFilterFooterHtml();
return html;
}
function showItemSort()
{
dressOptions.currentFilterTab = 2;
storeFilterDialog();
var filterWindow = document.getElementById('filterWindow');
filterWindow.innerHTML = getItemSortHtml();
}
function showCurrentFilter()
{
switch(dressOptions.currentFilterTab)
{
case 2:
showItemSort();
break;
case 1:
showMfFilter();
break;
default:
showCommonFilter();
break;
}
}
function ShowCatRunes(catid, stateId, slotId)
{
var state = dressStates[stateId];
var slot = getSlotById(slotId);
if (state == null || slot == null)
{
return;
}
if (!(catid in categories) || (!catid in catRunes))
{
return;
}
var html='';
var tableWidth = 5 * 60;
var subRunes = catRunes[catid];
html += '<table width="' + (tableWidth+1) + '" style="table-layout:fixed;" cellspacing="0" cellpadding="0" border="0"><tr><td align="left" valign="top" width="' + tableWidth + '">';
html += '<table width="' + tableWidth + '" style="table-layout:fixed;" cellspacing="0" cellpadding="0" border="0">';
for (var subCatRune in subRunes)
{
html += '<tr>';
for (var i=0; i<=(subRunes[subCatRune].length)-1; i++)
{
var onclick = format("hideMenu(); ShowRuneOptions('{0}', '{1}', '{2}');", stateId, slotId, subRunes[subCatRune][i]);
html += '<td>' + getPersObjectImageHtml(state, slot, subRunes[subCatRune][i], dressOptions.showImages, onclick, 1) + '</td>';
}
html += '<td> </td></tr>';
}
if (canBeRunedBySuperRunes.indexOf(catid) != -1) {
for (var i=0; i<=superRunes.length-1; i++) {
if (i==0) { html += '<tr>'; }
if (i>0 && ((i/5)==Math.floor(i/5))) { html += '</tr><tr>'; }
var onclick = format("onSetRune('{0}', '{1}', '{2}', '0')", state.id, slot.id, superRunes[i]);
html += '<td>' + getPersObjectImageHtml(state, slot, superRunes[i], dressOptions.showImages, onclick, 1) + '</td>';
if (i==superRunes.length-1) { html += '</tr>'; }
}
}
html += '</table></td>';
html += '<td width="1"><img src="' + blankImgPath + '" width="1" height="100" border="0" /></td></tr>';
html += getRowMenuSeparatorHtml();
html += getRowMenuItemHtml(localizer.unRune, format("onUnRuneObject('{0}', '{1}', '')", state.id, slot.id));
html += getRowMenuSeparatorHtml();
html += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()')+'</table>';
showMenu(html);
if (is.ie)
{
window.event.returnValue = false;
}
return false;
}
function ShowRuneOptions(stateId, slotId, runeId)
{
var state = dressStates[stateId];
var slot = getSlotById(slotId);
var o=getObjectById(runeId);
if (state == null || slot == null || !('modify' in o))
{
return;
}
if (!('opts' in o.modify)) { return; }
if (o.modify.opts.length < 1) {return; }
var html='';
html ='<table width="300px" border="0">';
html +='<tr><td align="center">'+o.caption.bold()+'</td></tr>';
for (var a=0; a<= o.modify.opts.length-1; a++)
{
for (var imod in o.modify.opts[a])
{
if (!item_props[imod])
{ continue; }
html += getRowMenuItemHtml(getHtmlOfSignedProp(o.modify.opts[a], item_props[imod], imod, null, null, null), format("onSetRune('{0}', '{1}', '{2}', '{3}')", state.id, slot.id, o.id, a));
}
}
//html += getRowMenuItemHtml(localizer.noSharpening, format("onSharpWeapon('{0}', '{1}', 0)", state.id, slot.id));
html += getRowMenuSeparatorHtml();
html += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()')+'</table>';
showMenu(html);
if (is.ie)
{
window.event.returnValue = false;
}
return false;
}
function onSetRune(stateId, slotId, runeId, optId)
{
hideMenu();
var state = dressStates[stateId];
var slot = getSlotById(slotId);
var o=getObjectById(runeId);
if (state == null || slot == null || !('modify' in o))
{
return;
}
if (!('opts' in o.modify)) { return; }
if (o.modify.opts[optId] == null) { return; }
state.runeSlots[slot.index]=runeId+'#'+optId;
updateDresserSlot(state, slot);
}
function applyItemsToCategoryView()
{
var hashv = getFilterHash();
var state = activeState;
var itemsView = document.getElementById('itemsView');
var html = '';
var catid = document.getElementById('chosenCategory').value;
if (!(catid in catlistsources))
{
catlistsources[catid] = {};
}
var cathash = catlistsources[catid];
if (hashv in cathash)
{
html = cathash[hashv];
}
else
{
var tableWidth = 8 * 60;
var slotid = document.getElementById('chosenSlot').value;
var cat = categories[catid];
var slot = getSlotById(slotid);
var perRow = (dressOptions.showImages) ? (tableWidth / slot.width) : 3;
var fitems = getFilteredItems(cat.items);
html += '<table width="' + (tableWidth+1) + '" style="table-layout:fixed;" cellspacing="0" cellpadding="0" border="0"><tr><td align="left" valign="top" width="' + tableWidth + '">';
html += '<table width="' + tableWidth + '" style="table-layout:fixed;" cellspacing="0" cellpadding="0" border="0"><tr>';
for (var i = 0; i < fitems.length; i++)
{
var onclick = format("hideMenu(); onItemWear('{0}', '{1}')", slotid, fitems[i].id);
html += '<td>' +
getPersObjectImageHtml(state, slot, fitems[i].id, dressOptions.showImages, onclick);
html += '</td>';
if ((i % perRow) == (perRow - 1))
{
html += '</tr><tr>';
}
}
html += '</tr></table></td>';
html += '<td width="1"><img src="' + blankImgPath + '" width="1" height="200" border="0" /></td></tr></table>';
cathash[hashv] = html;
}
itemsView.innerHTML = html;
}
function onCategorySelect(stateid, slotid, catId)
{
setupFilterFialog();
clearMenuOnceWhenClosed = true;
var cat = categories[catId];
var state = dressStates[stateid];
var slot = getSlotById(slotid);
if (state == null || slot == null || cat == null)
{
return;
}
var menuHtml = '';
if (catId in catselsources)
{
menuHtml = catselsources[catId];
}
else
{
var tableWidth = 8 * 60;
tableWidth += 1;
menuHtml += '<div id="filterWindow" style="position:absolute; visibility: hidden; left:4px; top:20px; width:' + (tableWidth - 8) + 'px; z-index:12; background-color:white; border:1px solid black; filter:alpha(opacity = 95, style = 4), blendtrans(duration = 0.3) progid:DXImageTransform.Microsoft.Shadow(color=' + "'#666666'" + ', Direction=135, Strength=4); font-size:10px"></div>';
menuHtml += '<div style="width:' + tableWidth + 'px; ">';
menuHtml += '<table width="' + tableWidth + '" cellspacing="0" cellpadding="0" border="0"><tr><td><b style="font-size: 16px;">';
menuHtml += cat.caption;
menuHtml += '</b></td>';
menuHtml += getCellMenuItemHtml_Core('<span style="font-size: 10px;">' + localizer.setFilter + '</span>', 'onSetInlineFilter()');
menuHtml += getCellMenuSeparatorHtml();
menuHtml += getCellMenuItemHtml_Core('<span style="font-size: 10px;">' + localizer.resetFilter + '</span>', 'onResetInlineFilter()');
menuHtml += '</tr></table>';
menuHtml += '<input type="hidden" id="chosenSlot" value="' + slotid + '" />';
menuHtml += '<input type="hidden" id="chosenCategory" value="' + catId + '" />';
menuHtml += '<table width="' + tableWidth + '" style="cellspacing="0" cellpadding="0" border="0"><tr><td valign="top">';
//menuHtml += '<div id="itemsView" style="width: 500px; height:250px; overflow:auto; filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1,enabled=false) progid:DXImageTransform.Microsoft.Alpha(opacity=50,style=0,enabled=false);"><center>Идёт фильтрация...</center></div>';
menuHtml += '<div id="itemsView" style="width: 100%; filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1,enabled=false) progid:DXImageTransform.Microsoft.Alpha(opacity=50,style=0,enabled=false);"><center>Идёт фильтрация...</center></div>';
menuHtml += '</td></tr><tr><td valign="bottom"><hr class="dashed" />';
menuHtml += '</td></tr>';
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
menuHtml += '</div>';
catselsources[catId] = menuHtml;
}
showMenu(menuHtml);
applyItemsToCategoryView();
}
function onItemWear(slotid, objId)
{
var state = activeState;
if (state == null) return;
setObjectForSlot(state, slotid, objId);
if (objId == null) return;
var o = getObjectById(objId);
if (o == null) return;
if (slotid == 'w3' && isSecondaryWeapon(o))
{
if (state.objects[slot_w10.index] == null)
{
setObjectForSlot(state, 'w10', objId);
}
}
if (slotid == 'w10' && isSecondaryWeapon(o))
{
if (state.objects[slot_w3.index] == null)
{
setObjectForSlot(state, 'w3', objId);
}
}
if (slotid == 'w6')
{
if (state.objects[slot_w7.index] == null)
{
setObjectForSlot(state, 'w7', objId);
}
if (state.objects[slot_w8.index] == null)
{
setObjectForSlot(state, 'w8', objId);
}
}
if (slotid == 'w7')
{
if (state.objects[slot_w6.index] == null)
{
setObjectForSlot(state, 'w6', objId);
}
if (state.objects[slot_w8.index] == null)
{
setObjectForSlot(state, 'w8', objId);
}
}
if (slotid == 'w8')
{
if (state.objects[slot_w6.index] == null)
{
setObjectForSlot(state, 'w6', objId);
}
if (state.objects[slot_w7.index] == null)
{
setObjectForSlot(state, 'w7', objId);
}
}
}
function onItemWearFrom(slotid, slotfromid)
{
var state = activeState;
var slotTo = getSlotById(slotid);
var slotFrom = getSlotById(slotfromid);
if (state == null || slotTo == null || slotFrom == null)
{
return;
}
state.objects[slotTo.index] = state.objects[slotFrom.index];
state.upgradeSlots[slotTo.index] = state.upgradeSlots[slotFrom.index];
state.fitSlots[slotTo.index] = state.fitSlots[slotFrom.index];
state.charmSlots[slotTo.index] = state.charmSlots[slotFrom.index];
state.addSlots[slotTo.index] = state.addSlots[slotFrom.index];
state.runeSlots[slotTo.index] = state.runeSlots[slotFrom.index];
state.objCache[slotTo.index] = state.objCache[slotFrom.index];
updateDresserSlot(state, slotTo);
}
function showItemProps(imgElt)
{
var o = null;
var state = getImgEltState(imgElt);
if (state == null)
{
state = activeState;
}
var slot = null;
if (isImgInSlot(imgElt))
{
slot = getImgEltSlot(imgElt);
o = getObjectByStateSlot(state, getImgEltSlot(imgElt));
}
if (o == null)
{
var oid = imgElt.name.substr(1);
o = getObjectById(oid);
}
showPopup(getObjectDescHtml(state, o));
}
function showItemProps2(stateid, oid)
{
var state = dressStates[stateid];
var o = getObjectById(oid);
showPopup(getObjectDescHtml(state, o));
}
function showSetProps(stateid, setid)
{
var state = dressStates[stateid];
var setd = getSetAndCountById(setid);
var html = getObjectDescHtml(state, setd.count)
var ahtml = '';
for (var scn in setd.set.details)
{
if (scn == setd.count.id) continue;
if (ahtml != '')
{
ahtml += '<hr class="dashed" width="120" />';
}
ahtml += getObjectDescHtml(state, setd.set.details[scn]);
}
if (ahtml != '')
{
html += '<hr width="120" /><i>' + localizer.setVariantsAvailable + '</i><blockquote>' + ahtml + '</blockquote>';
}
showPopup(html);
}
function showStrengtheningProps(stateid, strengtheningid)
{
var state = dressStates[stateid];
var strengthening = getStrengtheningById(strengtheningid);
showPopup(getObjectDescHtml(state, strengthening));
}
function getObjectByStateSlot(state, slot)
{
if (state == null || slot == null)
{
return null;
}
var obj = state.objCache[slot.index];
if (obj != null)
{
return obj;
}
obj = getObjectById(state.objects[slot.index]);
if (state.upgradeSlots[slot.index] != null)
{
obj = getUpgradeObject(obj, state.upgradeSlots[slot.index]);
}
if (state.fitSlots[slot.index] != null)
{
obj = getFittedObject(obj, state.fitSlots[slot.index]);
}
if (state.charmSlots[slot.index] != null)
{
obj = getCharmedObject2(obj, state.charmSlots[slot.index]);
}
if (state.addSlots[slot.index] != null)
{
obj = getAddObject2(obj, state.addSlots[slot.index]);
}
if (state.runeSlots[slot.index] != null)
{
obj = getRunedObject(obj, state.runeSlots[slot.index]);
}
if (state.fitArmor && (slot.id == 'w4'))
{
obj = getFittedArmor(obj);
}
else if ((state.w3sharp > 0) && (slot.id == 'w3'))
{
obj = getSharpenWeapon(obj, state.w3sharp);
}
else if ((state.w10sharp > 0) && (slot.id == 'w10'))
{
obj = getSharpenWeapon(obj, state.w10sharp);
}
state.objCache[slot.index] = obj;
return obj;
}
function getObjectFilter(state, slot, o)
{
var r = '';
if (o == null)
{
return r;
}
if (slot.id == 'w3' && state.w3sharp > 0)
{
r += 'blur ';
}
if (slot.id == 'w10' && state.w10sharp > 0)
{
r += 'blur ';
}
if (('armorWasFit' in o) && o.armorWasFit)
{
r += 'glo2 ';
}
if (('wasFit' in o) && o.wasFit)
{
r += 'glo2 ';
}
if (('wasUpgrade' in o) && o.wasUpgrade)
{
if ('fake' in o)
{
r += 'blueshadow ';
}
else
{
r += 'goldshadow ';
}
}
if (('wasCharmed' in o) && o.wasCharmed)
{
r += 'purpleshadow ';
}
if (('wasAdded' in o) && o.wasAdded)
{
r += 'redshadow ';
}
if (('wasRuned' in o) && o.wasRuned)
{
r += 'redshadow ';
}
return r;
}
function isImportantStateArray(a)
{
for (var i = 0; i < a.length; i++)
{
if (a[i] != null)
{
return true;
}
}
return false;
}
function getPackedObjectsRepresentation(a)
{
var r = '';
var rl = 0;
for (var i = 0; i < a.length; i++)
{
if (a[i] != null)
{
rl = i + 1;
}
}
for (var i = 0; i < rl; i++)
{
if (i > 0)
{
r += '/';
}
if (a[i] != null)
{
r += a[i];
}
}
return r;
}
function getUnpackedObjectsRepresentation(pa)
{
var r = new Array(slots.length);
var a = pa.split('/');
for (var i = 0; i < a.length; i++)
{
if (a[i] != '')
{
r[i] = a[i];
}
}
return r;
}
function getSerializableState(state)
{
var r = {};
r.version = serializableStateFormatVersion;
if (state.name != '')
{
r.name = state.name;
}
if (state.align != '0')
{
r.align = state.align;
}
if (state.clan != '')
{
r.clan = state.clan;
}
if (state.sex != 0)
{
r.sex = state.sex;
}
if (state.image != '0')
{
r.image = state.image;
}
if (state.sign != '')
{
r.sign = state.sign;
}
r.natural = {};
for (var i = 0; i < knownNaturalEditors.length; i++)
{
var propName = knownNaturalEditors[i];
if (propName == '-')
{
continue;
}
if (propName in state.natural)
{
var v = state.natural[propName];
if (v > 0)
{
r.natural[propName] = v;
}
}
}
if (isImportantStateArray(state.objects))
{
// r.objects = cloneArray(state.objects);
r.o1 = getPackedObjectsRepresentation(state.objects);
}
if (state.w3sharp > 0)
{
r.w3sharp = state.w3sharp;
}
if (state.w10sharp > 0)
{
r.w10sharp = state.w10sharp;
}
if (state.fitArmor)
{
r.fitArmor = state.fitArmor;
}
if (isImportantStateArray(state.fitSlots))
{
// r.fitSlots = cloneArray(state.fitSlots);
r.fs1 = getPackedObjectsRepresentation(state.fitSlots);
}
if (isImportantStateArray(state.upgradeSlots))
{
// r.upgradeSlots = cloneArray(state.upgradeSlots);
r.us1 = getPackedObjectsRepresentation(state.upgradeSlots);
}
if (isImportantStateArray(state.charmSlots))
{
// r.charmSlots = cloneArray(state.charmSlots);
r.cs1 = getPackedObjectsRepresentation(state.charmSlots);
}
if (isImportantStateArray(state.addSlots))
{
// r.charmSlots = cloneArray(state.charmSlots);
r.cs3 = getPackedObjectsRepresentation(state.addSlots);
}
if (isImportantStateArray(state.runeSlots))
{
// r.charmSlots = cloneArray(state.charmSlots);
r.cs2 = getPackedObjectsRepresentation(state.runeSlots);
}
if (state.statElix != null)
{
r.statElix = state.statElix;
}
if (state.spellIntel > 0)
{
r.spellIntel = state.spellIntel;
}
if (state.spellBD > 0)
{
r.spellBD = state.spellBD;
}
if (state.spellHitpoints > 0)
{
r.spellHitpoints = state.spellHitpoints;
}
var hasPowerUps = false;
for (var powerupn in state.spellPowerUps)
{
hasPowerUps = true;
break;
}
if (hasPowerUps)
{
r.spellPowerUps = state.spellPowerUps;
}
var hasDamageElixes = false;
for (var powerupn in state.damageElixes)
{
hasDamageElixes = true;
break;
}
if (hasDamageElixes)
{
r.damageElixes = state.damageElixes;
}
var hasDefElixes = false;
for (var powerupn in state.defElixes)
{
hasDefElixes = true;
break;
}
if (hasDefElixes)
{
r.defElixes = state.defElixes;
}
if (state.pet != null)
{
r.pet = state.pet;
}
if (isImportantStateArray(state.trickSlots))
{
r.ts1 = getPackedObjectsRepresentation(state.trickSlots);
}
return r;
}
function getRightSizeArray(a, rightSize)
{
if (a.length == rightSize)
{
return a;
}
var r = new Array(rightSize);
for (var i = 0; (i < rightSize) && (i < a.length); i++)
{
r[i] = a[i];
}
return r;
}
function applyDeserializedState(stateid, r)
{
if (r == null)
{
return;
}
if (r.version != serializableStateFormatVersion)
{
alert ("incompatible version of serialized state. expected " + serializableStateFormatVersion + " but got " + v);
return;
}
var replaceMode = (stateid != null) && ((stateid in dressStates) || (stateid in droppedDressStates));
var state = createNewDresserState(stateid);
if ('name' in r)
{
state.name = r.name;
}
if ('align' in r)
{
state.align = r.align;
}
if ('clan' in r)
{
state.clan = r.clan;
}
if ('sex' in r)
{
state.sex = r.sex;
}
if ('image' in r)
{
state.image = r.image;
}
if ('sign' in r)
{
state.sign = r.sign;
}
state.natural = r.natural;
if (!('pstat' in state.natural))
{
state.natural.pstat = 0;
state.natural.pskil = 0;
}
if ('objects' in r)
{
state.objects = getRightSizeArray(r.objects, slots.length);
}
if ('o1' in r)
{
state.objects = getRightSizeArray(getUnpackedObjectsRepresentation(r.o1), slots.length);
}
if ('w3sharp' in r)
{
state.w3sharp = parseInt(r.w3sharp);
}
if ('w10sharp' in r)
{
state.w10sharp = parseInt(r.w10sharp);
}
if ('fitArmor' in r)
{
state.fitArmor = r.fitArmor;
}
if ('fitSlots' in r)
{
state.fitSlots = getRightSizeArray(r.fitSlots, slots.length);
}
if ('fs1' in r)
{
state.fitSlots = getRightSizeArray(getUnpackedObjectsRepresentation(r.fs1), slots.length);
}
if ('upgradeSlots' in r)
{
state.upgradeSlots = getRightSizeArray(r.upgradeSlots, slots.length);
}
if ('us1' in r)
{
state.upgradeSlots = getRightSizeArray(getUnpackedObjectsRepresentation(r.us1), slots.length);
}
if ('charmSlots' in r)
{
state.charmSlots = getRightSizeArray(r.charmSlots, slots.length);
}
if ('addSlots' in r)
{
state.addSlots = getRightSizeArray(r.addSlots, slots.length);
}
if ('charmSlots' in r)
{
state.charmSlots = getRightSizeArray(r.charmSlots, slots.length);
}
if ('runeSlots' in r)
{
state.runeSlots = getRightSizeArray(r.runeSlots, slots.length);
}
if ('cs1' in r)
{
state.charmSlots = getRightSizeArray(getUnpackedObjectsRepresentation(r.cs1), slots.length);
}
if ('cs2' in r)
{
state.runeSlots = getRightSizeArray(getUnpackedObjectsRepresentation(r.cs2), slots.length);
}
if ('cs3' in r) {
state.addSlots = getRightSizeArray(getUnpackedObjectsRepresentation(r.cs3), slots.length);
}
if (('statElix' in r) && (r.statElix.elixn in knownElix))
{
state.statElix = r.statElix;
}
if ('spellIntel' in r)
{
state.spellIntel = parseInt(r.spellIntel);
}
if ('spellBD' in r)
{
state.spellBD = parseInt(r.spellBD);
}
if ('spellHitpoints' in r)
{
state.spellHitpoints = parseInt(r.spellHitpoints);
}
if ('spellPowerUps' in r)
{
state.spellPowerUps = r.spellPowerUps;
}
if ('damageElixes' in r)
{
state.damageElixes = r.damageElixes;
}
if ('defElixes' in r)
{
state.defElixes = r.defElixes;
}
if ('pet' in r)
{
state.pet = r.pet;
}
if ('ts1' in r)
{
state.trickSlots = getRightSizeArray(getUnpackedObjectsRepresentation(r.ts1), 23);
}
for (var i = 0; i < slots.length; i++)
{
if (state.objects[i] == null)
{
continue;
}
var o = getObjectById(state.objects[i]);
if (o == null)
{
state.objects[i] = null;
state.fitSlots[i] = null;
state.upgradeSlots[i] = null;
state.charmSlots[i] = null;
state.addSlots[i] = null;
state.runeSlots[i] = null;
continue;
}
if (state.upgradeSlots[i] != null)
{
if (!('upgrade' in o) || !(getJSName(state.upgradeSlots[i]) in o.upgrade))
{
state.upgradeSlots[i] = null;
}
}
}
for (var ti = 0; i < state.trickSlots.length; i++)
{
var trick = state.trickSlots[ti];
if (trick != null)
{
if (!(getJSName(trick) in tricks))
{
state.trickSlots[ti] = null;
}
}
}
activeState = state;
updateTabs(false);
if (replaceMode)
{
hardUpdateDresserState(state);
}
else
{
recalcDresserState(state);
updateCabs();
}
changeCab(state.id);
someStatesLoaded = true;
}
function loadEnteredSet(key)
{
var state = activeState;
if (state == null) {
alert('Internal Error.');
return;
}
if (key == null) {
telt = document.getElementById('setArea');
if (telt == null) {
alert('Internal Error.');
return;
}
key = telt.value;
}
if (key.indexOf(window.location.protocol + '//' + window.location.host + window.location.pathname + '?key=') === 0) {
key = key.replace(window.location.protocol + '//' + window.location.host + window.location.pathname + '?key=', '');
}
if (/^\w{8}-\w{4}-4\w{3}-\w{4}-\w{12}$/.test(key) === false) {
alert('Формат ключа не поддерживается.');
return;
}
db.collection("sets").doc(key).get().then(function(doc) {
if (doc.exists) {
var text = doc.data().set;
var dstate = deserializeObject(text);
applyDeserializedState(state.id, dstate);
} else {
alert('Комплект ' + key + ' не найден');
}
}).catch(function(error) {
alert("Error getting document: " + error);
});
}
function onLoadSet(stateid)
{
var menuHtml ='<table width="340" border="0"><tr><td>';
menuHtml += format(localizer.loadSetHint, clanImgPath);
menuHtml += '<br /><textarea id="setArea" cols="60" rows="8" wrap="VIRTUAL">';
menuHtml += '</textarea></td></tr>';
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.loadSet, "loadEnteredSet()");
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table>';
showMenu(menuHtml, false);
var telt = document.getElementById('setArea');
if (telt != null)
{
telt.focus();
telt.select();
}
}
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
function onSaveSet(stateid)
{
var state = dressStates[stateid];
if (state == null)
{
alert('Internal Error. Nothing to save!');
return;
}
if (confirm('Подтвердите сохранение комплекта...')) {
var key = uuidv4(),
url = window.location.protocol + '//' + window.location.host + window.location.pathname + '?key=' + key,
text = serializeObject(getSerializableState(state));
db.collection("sets").doc(key).set({
set: text
})
.then(function() {
var menuHtml ='<table width="340" border="0"><tr><td>';
menuHtml += format(localizer.saveSetHint, clanImgPath);
menuHtml += '<br /><textarea id="setArea" class="inpText" cols="60" rows="8" wrap="VIRTUAL" readonly="true">';
menuHtml += url;
menuHtml += '</textarea></td></tr>';
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, "hideMenu()");
menuHtml += '</table>';
showMenu(menuHtml, false);
var telt = document.getElementById('setArea');
if (telt != null)
{
telt.focus();
telt.select();
}
})
.catch(function(error) {
alert("Error writing document: " + error);
});
}
}
function getNextGoodSlot(o, slot)
{
if (slot.id == 'w3')
{
if (isSecondaryWeapon(o))
{
return getSlotById('w10');
}
}
else
{
var ngsSpellsData = [];
for (var i = 100; i <= 109; i++)
{
ngsSpellsData.push('w' + i);
}
var ngsData = new Array(
new Array('w6', 'w7', 'w8'),
new Array('w14', 'w15', 'w16'),
ngsSpellsData
);
for (var i = 0; i < ngsData.length; i++)
{
var ngsDataRow = ngsData[i];
for (j = 0; j < (ngsDataRow.length - 1); j++)
{
if (slot.id == ngsDataRow[j])
{
return getSlotById(ngsDataRow[j + 1]);
}
}
}
}
return null;
}
function testShortInfoRe(state, o, s, re, sharp, minvname, maxvname)
{
var m = s.match(re);
if (m != null)
{
var ou = null;
var minm = parseInt(m[1]);
var maxm = parseInt(m[2]);
for (var upgraden in o.upgrade)
{
var uobj = getUpgradeObject(o, upgraden);
if (!('level' in uobj) || (uobj.level > state.natural.level))
{
continue;
}
if (sharp > 0)
{
uobj = getSharpenWeapon(uobj, sharp);
}
if ('properties' in uobj)
{
var pou = null;
if (minvname in uobj.properties)
{
if (uobj.properties[minvname] > minm)
{
break;
}
pou = upgraden;
}
if (maxvname in uobj.properties)
{
if (uobj.properties[maxvname] > maxm)
{
break;
}
if ((minvname in uobj.properties) && pou == null)
{
continue;
}
pou = upgraden;
}
if (pou != null) ou = pou;
}
if ('modify' in uobj)
{
var pou = null;
if (minvname in uobj.modify)
{
if (uobj.modify[minvname] > minm)
{
break;
}
pou = upgraden;
}
if (maxvname in uobj.modify)
{
if (uobj.modify[maxvname] > maxm)
{
break;
}
if ((minvname in uobj.modify) && pou == null)
{
continue;
}
pou = upgraden;
}
if (pou != null) ou = pou;
}
}
return {upgraden: ou, found: true};
}
return {upgraden: null, found: false};
}
function testShortInfoRe1(state, o, s, re, sharp, vname)
{
var m = s.match(re);
if (m != null)
{
var ou = null;
var m1 = parseInt(m[1]);
for (var upgraden in o.upgrade)
{
var uobj = getUpgradeObject(o, upgraden);
if (!('level' in uobj) || (uobj.level > state.natural.level))
{
continue;
}
if (sharp > 0)
{
uobj = getSharpenWeapon(uobj, sharp);
}
if ('properties' in uobj)
{
if (vname in uobj.properties)
{
if (uobj.properties[vname] > m1)
{
break;
}
ou = upgraden;
}
}
if ('modify' in uobj)
{
if (vname in uobj.modify)
{
if (uobj.modify[vname] > m1)
{
break;
}
ou = upgraden;
}
}
}
return {upgraden: ou, found: true};
}
return {upgraden: null, found: false};
}
function applyAssortedObject(state, oid, odic)
{
var o = getObjectById(oid);
if (o == null)
{
return;
}
var ou = null;
if ('baseitem' in o)
{
ou = o.id;
o = getObjectById(o.baseitem);
}
var baseSlot = getSlotById(o.slot);
for (var slot = baseSlot; slot != null; slot = getNextGoodSlot(o, slot))
{
if (state.objects[slot.index] == null)
{
state.objects[slot.index] = o.id;
var odicname = (odic.length > 0) ? odic[0] : '';
if (baseSlot.id == 'w3')
{
// look for sharpness
var sharps = odicname.match(reSharpness);
if (sharps != null)
{
state[slot.id + 'sharp'] = parseInt(sharps[1]);
}
if (('upgrade' in o) && (ou == null))
{
for (var i = 1; i < odic.length; i++)
{
var r = testShortInfoRe(state, o, odic[i], reDamage, state[slot.id + 'sharp'], 'mindamage', 'maxdamage');
if (r.found)
{
ou = r.upgraden;
break;
}
}
}
}
else
{
if (('upgrade' in o) && (ou == null))
{
for (var i = 1; i < odic.length; i++)
{
var r = testShortInfoRe1(state, o, odic[i], reHitPoints, 0, 'hitpoints');
if (r.found)
{
ou = r.upgraden;
break;
}
r = testShortInfoRe(state, o, odic[i], reHeadArmor, 0, 'headarmor1', 'headarmor2');
if (r.found)
{
ou = r.upgraden;
break;
}
r = testShortInfoRe(state, o, odic[i], reBodyArmor, 0, 'bodyarmor1', 'bodyarmor2');
if (r.found)
{
ou = r.upgraden;
break;
}
r = testShortInfoRe(state, o, odic[i], reWaistArmor, 0, 'waistarmor1', 'waistarmor2');
if (r.found)
{
ou = r.upgraden;
break;
}
r = testShortInfoRe(state, o, odic[i], reLegArmor, 0, 'legarmor1', 'legarmor2');
if (r.found)
{
ou = r.upgraden;
break;
}
}
}
}
if (ou != null)
{
state.upgradeSlots[slot.index] = ou;
}
state.objCache[slot.index] = null;
break;
}
}
}
function _x_cabTo(id, val)
{
var tval = val ? 'activeLink' : 'usualLink';
document.getElementById(id).className = tval;
}
function _x_cabOn(id)
{
var _obj = document.getElementById(id);
if (null != _obj) {
document.getElementById(id).className = 'activeLink';
}
}
function _x_cabOff(id)
{
var _obj = document.getElementById(id);
if (null != _obj) {
document.getElementById(id).className = 'usualLink';
}
}
function changeCab(cabid)
{
activeState = null;
hidePopup();
hideMenu();
var stateCount = 0;
for (var staten in dressStates)
{
stateCount++;
}
for (var staten in dressStates)
{
var state = dressStates[staten];
var tval = (state.id == cabid) ? 'activeLink' : 'usualLink';
var dval = (state.id == cabid) ? '' : 'none';
_x_cabTo('tab_' + state.id, (state.id == cabid), dressOptions.useTransitionEffects);
if (state.id == cabid)
{
activeState = state;
fastUpdateDresserState(state);
}
document.getElementById('cab_' + state.id).style.display = dval;
}
if (cabid == 'summary')
{
_x_cabOn('tabx_summary', dressOptions.useTransitionEffects);
showSummary();
}
else
{
_x_cabOff('tabx_summary', dressOptions.useTransitionEffects);
hideSummary();
}
if (cabid == 'exptable')
{
_x_cabOn('tabx_exptable', dressOptions.useTransitionEffects);
showExpTable();
}
else if (dressOptions.showExp)
{
_x_cabOff('tabx_exptable', dressOptions.useTransitionEffects);
hideExpTable();
}
if (cabid == 'healer')
{
_x_cabOn('tabx_healer', dressOptions.useTransitionEffects);
showHealer();
}
else if (dressOptions.showHealer)
{
_x_cabOff('tabx_healer', dressOptions.useTransitionEffects);
hideHealer();
}
if (cabid == 'battles')
{
_x_cabOn('tabx_battles', dressOptions.useTransitionEffects);
showBattles();
}
else
{
_x_cabOff('tabx_battles', dressOptions.useTransitionEffects);
hideBattles();
}
if (cabid == 'builder')
{
_x_cabOn('tabx_builder', dressOptions.useTransitionEffects);
showBuilder();
}
else if (dressOptions.showBuilder)
{
_x_cabOff('tabx_builder', dressOptions.useTransitionEffects);
hideBuilder();
}
}
function createCab()
{
var state = createNewDresserState(null);
activeState = null;
updateTabs(true);
updateCabs();
activeState = null;
updateDresserState(state);
changeCab(state.id);
}
function removeCab2(cabId)
{
var stateCount = 0;
for (var staten in dressStates)
{
stateCount++;
}
if (stateCount < 2)
{
alert('Удаление единственной кабинки не разрешается');
return;
}
if (activeState.id == cabId)
{
activeState = null;
}
var nextActiveState = null;
for (var staten in dressStates)
{
var state = dressStates[staten];
if (state.id == cabId)
{
droppedDressStates[staten] = cabId;
document.getElementById('cab_' + state.id).style.display = 'none';
delete dressStates[staten];
break;
}
nextActiveState = state;
}
if (nextActiveState == null)
{
for (var staten in dressStates)
{
var state = dressStates[staten];
nextActiveState = state;
break;
}
}
if (activeState == null)
{
activeState = nextActiveState;
}
updateTabs(false);
changeCab(activeState.id);
}
function getTabsHtml(tabActive)
{
var html = '';
var stateCount = 0;
var classn;
var i = 1;
for(var staten in dressStates)
{
var state = dressStates[staten];
classn = (activeState != null && state.id == activeState.id) ? 'activeLink' : 'usualLink';
html += format('<li id="tab_{5}" class="{2}"><a href="javascript:;" onclick="changeCab({4})"><nobr>{0} {1} <img onclick="removeCab2({4})" src="{3}closeCab.gif" width="10" height="10" border="0" title="{6}" /></nobr></a></li>', localizer.upperCab, i, classn, hereItemImgPath, "'" + state.id + "'", state.id, localizer.closeCab);
stateCount++;
i++;
}
html += format('<li id="tabx_newcab"><a title="{1}" onclick="createCab()" href="javascript:;"><nobr>{0}</nobr></a></li>', localizer.newCab, localizer.newCabHint);
html += format('<li id="tabx_summary"><a title="{1}" onclick="changeCab({2})" href="javascript:;"><nobr>{0}</nobr></a></li>', localizer.summaryTableCab, localizer.summaryTableHint, "'summary'");
if (dressOptions.showExp)
{
html += format('<li id="tabx_exptable"><a title="{1}" onclick="changeCab({2})" href="javascript:;"><nobr>{0}</nobr></a></li>', localizer.expTableCab, '', "'exptable'");
}
if (dressOptions.showHealer)
{
html += format('<li id="tabx_healer"><a title="{1}" onclick="changeCab({2})" href="javascript:;"><nobr>{0}</nobr></a></li>', localizer.healerCab, 'Комната Знахаря позволит рассчитать порядок и стоимость перекидки статов в комнате Знахаря для перехода от одного комплекта к другому.', "'healer'");
}
if (dressOptions.showBuilder)
{
//html += format('<li id="tabx_builder"><a title="{1}" onclick="changeCab({2})" href="javascript:;"><nobr>{0}</nobr></a></li>', localizer.designerCab, 'Конструктор позволит Вам создать уникальные предметы и их модификации.', "'builder'");
}
//html += format('<li id="tabx_battles"><a title="{1}" onclick="changeCab({2})" href="javascript:;"><nobr>{0}</nobr></a></li>', localizer.battlesCab, 'Позволяет провести тестовые поединки.', "'battles'");
return html;
}
function getCabsHtml()
{
var html = '';
for(var staten in dressStates)
{
var state = dressStates[staten];
if (state.rendered)
{
continue;
}
if (staten in droppedDressStates)
{
delete droppedDressStates[staten];
state.rendered = true;
hardUpdateDressState(state);
continue;
}
html += format('<div id="cab_{0}" style="display: none">{1}</div>', state.id, getDresserInnerHtml(state));
state.rendered = true;
}
return html;
}
function updateTabs(tabActive)
{
document.getElementById('nav').innerHTML = getTabsHtml(tabActive);
}
function updateCabs()
{
var cabs = document.getElementById('dressCabs');
var appendum = getCabsHtml();
if (cabs.insertAdjacentHTML)
{
cabs.insertAdjacentHTML('beforeEnd', appendum);
}
else
{
cabs.innerHTML = cabs.innerHTML + appendum;
}
}
function showScriptStatus(msg)
{
informAboutProgress(msg);
}
function showDressHint()
{
/*var i = Math.floor(Math.random() * dressHints.length);
informAboutProgress('<font color="red">' + localizer.tip + ':</font> ' + dressHints[i]);*/
}
function getSerializedDresser()
{
var dresser = [];
for (staten in dressStates)
{
var state = dressStates[staten];
var serState = getSerializableState(state);
dresser.push(serState);
}
dressExData.fakeDefs = {};
for (var i in dressExData.fakes)
{
var fid = dressExData.fakes[i];
var fake = getFake(fid);
dressExData.fakeDefs[getJSName(fid)] = fake;
}
dresser.push(dressExData);
return serializeArray(dresser);
}
function applyDeserializedDresser(serDresser)
{
if (serDresser == '')
{
return;
}
var dresser = deserializeArray(serDresser);
for (var i = 0; i < dresser.length; i++)
{
var serState = dresser[i];
if ('exdata' in serState)
{
if (serState.exdata != 4)
{
continue;
}
dressExData = serState;
// do something
for (var i in dressExData.fakes)
{
var fid = dressExData.fakes[i];
var fake = dressExData.fakeDefs[getJSName(fid)];
if (fake != null)
{
createFake(fid, fake);
}
else
{
delete dressExData.fakes[i];
}
}
break;
}
}
for (var i = 0; i < dresser.length; i++)
{
var serState = dresser[i];
if (!('exdata' in serState))
{
applyDeserializedState(null, serState);
}
}
}
function loadFav()
{
if (isOfflineMode())
{
return;
}
var favstore = document.getElementById(favStoreId);
favstore.value = favstore.getAttribute("sPersistAttr") || '';
applyDeserializedDresser(favstore.value);
}
function saveFav()
{
if (isOfflineMode())
{
return;
}
var favstore = document.getElementById(favStoreId);
favstore.value = getSerializedDresser();
favstore.setAttribute("sPersistAttr", favstore.value);
}
function loadHistory()
{
if (dressOptions.embeddedMode && window.external && window.external.storage)
{
applyDeserializedDresser(window.external.storage.getPersistentVariable(historyStoreId));
return;
}
if (isOfflineMode())
{
return;
}
if (is.ie)
{
var historystore = document.getElementById(historyStoreId);
historystore.load(historyStoreId);
historystore.value = historystore.getAttribute("sPersistAttr") || '';
applyDeserializedDresser(historystore.value);
}
else if (is.ff2)//typeof (globalStorage) != 'undefined')
{
var storage = globalStorage[window.location.hostname];
var dcdresser =storage.getItem('dcdresser');
if (dcdresser && 'historyStoreId' in dcdresser)
{
applyDeserializedDresser(storage.dcdresser[historyStoreId]);
}
}
}
function saveHistory()
{
if (dressOptions.embeddedMode && window.external && window.external.storage)
{
window.external.storage.setPersistentVariable(historyStoreId, getSerializedDresser());
return;
}
if (isOfflineMode())
{
return;
}
if (is.ie)
{
var historystore = document.getElementById(historyStoreId);
historystore.value = getSerializedDresser();
historystore.setAttribute("sPersistAttr", historystore.value);
historystore.save(historyStoreId);
}
else if (is.ff2)//typeof (globalStorage) != 'undefined')
{
var storage = globalStorage[window.location.hostname];
var dcdresser = {};
if (storage.getItem('dcdresser'))
{
dcdresser = storage.getItem('dcdresser');
}
dcdresser[historyStoreId] = getSerializedDresser();
storage.setItem('dcdresser', dcdresser);
}
}
window.onunload = saveHistory;
function isOfflineMode()
{
return (['http:', 'https:'].indexOf(location.protocol) == -1);
}
function isEmbeddedMode()
{
return (dressOptions.embeddedMode);
}
function prepareEmbeddedMode()
{
baseImgPath = window.external.getCombatsClientEnv('BaseImgPath');
itemImgPath = window.external.getCombatsClientEnv('ItemImgPath');
hereItemImgPath = window.external.getCombatsClientEnv('HereItemImgPath');
charImgPath = window.external.getCombatsClientEnv('CharImgPath');
clanImgPath = window.external.getCombatsClientEnv('ClanImgPath');
zodiacImgPath = window.external.getCombatsClientEnv('ZodiacImgPath');
brandImgPath = window.external.getCombatsClientEnv('BrandImgPath');
brand2ImgPath = window.external.getCombatsClientEnv('Brand2ImgPath');
hpMeterGreenImg = window.external.getCombatsClientEnv('HpMeterGreenImg');
manaMeterImg = window.external.getCombatsClientEnv('ManaMeterImg');
infospaceImgPath = 'images/infospace/';
dressImgPath = 'images/dress/';
blankImgPath = 'images/blank.gif';
zodiacImgPath = 'images/dress/z/';
saveSetOnServerUrl = absoluteDressRoomUrl + '?action=save&saveset=1&offline=1&texttosave={0}';
getCharacterInfoUrlFormat = '/cgi/get_ci.pl?nick={0}';
}
function prepareOfflineMode()
{
if (!isOfflineMode())
{
return;
}
if (isEmbeddedMode())
{
prepareEmbeddedMode();
}
else
{
baseImgPath = '';
itemImgPath = '';
hereItemImgPath = '';
charImgPath = 'images/';
clanImgPath = '';
zodiacImgPath = '';
brandImgPath = 'brand/';
brand2ImgPath = 'misc/';
trickImgPath = '';
trickResourceImgPath = '';
hpMeterGreenImg = 'bk_life_green.gif';
manaMeterImg = 'bk_life_beg_33.gif';
infospaceImgPath = 'images/infospace/';
dressImgPath = 'dress/';
blankImgPath = 'blank.gif';
zodiacImgPath = 'dress/z/';
saveSetOnServerUrl = absoluteDressRoomUrl + '?action=save&saveset=1&offline=1&texttosave={0}';
getCharacterInfoUrlFormat = '/cgi/get_ci.pl?nick={0}';
}
}
function GetOfflineCookie(dressOptionsCookieName)
{
if (dressOptions.embeddedMode && window.external && window.external.storage)
{
return window.external.storage.getPersistentVariable(dressOptionsCookieName);
}
if (isOfflineMode())
{
return null;
}
var offlineCookie = document.getElementById(offlineCookieId);
offlineCookie.load(offlineCookieId);
return offlineCookie.getAttribute(dressOptionsCookieName) || null;
}
function SetOfflineCookie(dressOptionsCookieName, v, exp)
{
if (dressOptions.embeddedMode && window.external && window.external.storage)
{
window.external.storage.setPersistentVariable(dressOptionsCookieName, v);
}
if (isOfflineMode())
{
return;
}
var offlineCookie = document.getElementById(offlineCookieId);
offlineCookie.setAttribute(dressOptionsCookieName, v);
offlineCookie.save(offlineCookieId);
}
function isCompatibleBrowser()
{
if (!is.ie)
{
var ffstr = 'Firefox/';
if (navigator.userAgent.indexOf(ffstr) >= 0)
{
return (parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf(ffstr) + ffstr.length)) >= 1.5);
}
if (is.opera)
{
return true;
}
return false;
}
var msiestr = 'MSIE ';
return (parseFloat(is.version.substr(is.version.indexOf(msiestr) + msiestr.length)) >= 5.5);
}
function cloneRings()
{
for (var i = 7; i <= 8; i++)
{
var r = {
caption: categories.rings.caption,
slot: ('w' + i),
items: categories.rings.items,
basecat: categories.rings
};
categories['rings' + i] = r;
}
}
function cloneFlowers()
{
var r = {
caption: categories.flowers.caption,
slot: 'w10',
items: categories.flowers.items,
basecat: categories.flowers
};
categories['flowersw10'] = r;
}
function cloneFirs()
{
var r = {
caption: categories.firs.caption,
slot: 'w10',
items: categories.firs.items,
basecat: categories.firs
};
categories['firsw10'] = r;
}
function getSetVariants(set)
{
if (!('variants' in set))
{
var slotItems = [];
for (var i = 0; i < slots.length; i++)
{
var slot = slots[i];
slotItems[slot.index] = getSetItemsForSlot(set, slot);
}
set.variants = slotItems;
}
return set.variants;
}
function cloneScrolls() //свитки в слоты
{
for (var i = 101; i <= 109; i++)
{
var cscrolls = {
caption: categories.combatscrolls.caption,
slot: ('w' + i),
items: categories.combatscrolls.items,
basecat: categories.combatscrolls
};
categories['combatscrolls' + i] = cscrolls;
var ascrolls = {
caption: categories.auxiliaryscrolls.caption,
slot: ('w' + i),
items: categories.auxiliaryscrolls.items,
basecat: categories.auxiliaryscrolls
};
categories['auxiliaryscrolls' + i] = ascrolls;
/*var sscrolls = {
caption: categories.summonscrolls.caption,
slot: ('w' + i),
items: categories.summonscrolls.items,
basecat: categories.summonscrolls
};
categories['summonscrolls' + i] = sscrolls;*/
var tscrolls = {
caption: categories.tacticalscrolls.caption,
slot: ('w' + i),
items: categories.tacticalscrolls.items,
basecat: categories.tacticalscrolls
};
categories['tacticalscrolls' + i] = tscrolls;
// var escrolls = { //зачарование
// caption: categories.enchantscrolls.caption,
// slot: ('w' + i),
// items: categories.enchantscrolls.items,
// basecat: categories.enchantscrolls
// };
// categories['enchantscrolls' + i] = escrolls;
}
}
function cloneCItems()
{
for (var i = 15; i <= 15; i++)
{
var citems = {
caption: categories.carmanitems.caption,
slot: ('w' + i),
items: categories.carmanitems.items,
basecat: categories.carmanitems
};
categories['carmanitems' + i] = citems;
}
}
function initializeDresserAfterItemsLoaded()
{
for (var catn in categories)
{
var cat = categories[catn];
if (cat.slot == 'w3')
{
cat.statBonuses = { strength: 100 };
}
}
// зависимость урона от типа пушки?
categories.legendaryweapon.canBeSharpen = true;
categories.knives.canBeSharpen = true;
categories.knives.skillname = 'knifeskill';
categories.knives.statBonuses = { strength: 60, dexterity: 40 };
categories.axes.canBeSharpen = true;
categories.axes.skillname = 'axeskill';
categories.axes.statBonuses = { strength: 70, dexterity: 20 };
categories.clubs.canBeSharpen = true;
categories.clubs.skillname = 'clubskill';
categories.clubs.statBonuses = { strength: 100 };
categories.swords.canBeSharpen = true;
categories.swords.skillname = 'swordskill';
categories.swords.statBonuses = { strength: 60, intuition: 40 };
categories.staffs.skillname = 'staffskill';
categories.staffs.statBonuses = { intellect: 33 };
categories.staffs.canBeSharpen = true;
dressStrengthenings.neutralPower = {id: 'neutralPower', caption: 'Сила Нейтрала',
required: {noWeapon: 1, neutralAlign: 1},
modify: {mindamage: 0, maxdamage: 1}
};
//cloneFlowers();
//cloneFirs();
cloneRings();
cloneScrolls();
cloneCItems();
createVirtualSets();
//buildSetVariants();
var hi = new Array('cat', 'bottle', 'hands', 'nude', 'armored');
/*for (var i = 0; i < hi.length; i++)
{
dc_preimg(dressImgPath + hi[i] + '_press.gif');
}*/
document.getElementById('dressCabs').innerHTML = '';
//dressItems.spell_godprotect10.buylink = knownECRPowerUps.spell_godprotect10.buylink;
/*knownAdds.food_l41 = dressItems.food_l41;
knownAdds.food_l61 = dressItems.food_l61;
knownAdds.food_l71 = dressItems.food_l71;
knownAdds.food_l8 = dressItems.food_l8;
knownAdds.food_8m1 = dressItems.food_8m1;
knownAdds.food_8m2 = dressItems.food_8m2;*/
knownAdds.food_l5_eng = dressItems.food_l5_eng;
/*knownAdds.pot_base_0_8m1 = dressItems.pot_base_0_8m1;*/
knownAdds.food_l10_e = dressItems.food_l10_e;
knownAdds.food_l11_e = dressItems.food_l11_e;
/*knownAdds.pot_base_0_2007_1 = dressItems.pot_base_0_2007_1;
knownAdds.pot_base_0_2007_6 = dressItems.pot_base_0_2007_6;
knownAdds.pot_base_0_2007_4 = dressItems.pot_base_0_2007_4;
knownAdds.pot_base_0_2007_2 = dressItems.pot_base_0_2007_2;
knownAdds.pot_base_0_2007_3 = dressItems.pot_base_0_2007_3;
knownAdds.pot_base_0_2007_8 = dressItems.pot_base_0_2007_8;
knownAdds.pot_base_0_2007_7 = dressItems.pot_base_0_2007_7;
knownAdds.pot_base_0_2007_5 = dressItems.pot_base_0_2007_5;
knownAdds.pot_base_0_8m3 = dressItems.pot_base_0_8m3;*/
dresInitialized = true;
}
function getTricksOfCategory(catno)
{
var tc = trickCategories[catno];
if (!('trickCache' in tc))
{
var r = [];
var cid = tc.id;
for (var trickn in tricks)
{
var trick = tricks[trickn];
if (trick.school != cid) continue;
r.push(trick);
}
tc.trickCache = r;
}
return tc.trickCache;
}
function getFilteredTricks(state, catno)
{
var r = [];
var ct = getTricksOfCategory(catno);
for (var ti = 0; ti < ct.length; ti++)
{
var trick = ct[ti];
if ('required' in trick)
{
if ('level' in trick.required)
{
if (trick.required.level > state.natural.level)
{
continue;
}
}
}
var alreadyWeared = false;
for (var i = 0; i < state.trickSlots.length; i++)
{
if (state.trickSlots[i] == trick.name)
{
alreadyWeared = true;
break;
}
}
if (alreadyWeared)
{
continue;
}
r.push(trick);
}
return r;
}
function getAllTricks(state, catno) {
var r = [];
var ct = getTricksOfCategory(catno);
for (var ti = 0; ti < ct.length; ti++)
{
var trick = ct[ti];
var alreadyWeared = false;
for (var i = 0; i < state.trickSlots.length; i++)
{
if (state.trickSlots[i] == trick.name)
{
alreadyWeared = true;
break;
}
}
if (alreadyWeared)
{
continue;
}
r.push(trick);
}
return r;
}
function showTrickProps(trickName)
{
if (trickName == 'clear')
{
showPopup(localizer.noTrickHint);
return;
}
var trick = tricks[trickName];
showPopup(getObjectDescHtml(activeState, trick));
}
function getFullTrickId(state, id)
{
return 'trickslot_' + state.id + '_' + id;
}
function getTrickImageHtml_Core(name, onclick, width, i)
{
var caption = localizer.noTrick;
var iname;
var path = trickImgPath;
if (name == null)
{
/* if (i >= 10)
{
name = 'clear';
iname = 'booklearn_slot7';
iname = 'booklearn_slot' + (i - 3);
path = itemImgPath;
}
else
{*/
name = iname = 'clear';
//}
}
else
{
caption = tricks[name].caption;
if ('iname' in tricks[name])
{
iname = tricks[name].iname;
}
else
{
iname = name;
}
}
if (width == null)
{
width = 40;
}
var html = format('<img src="{0}{2}.gif" width="40" height="25" border="0" onmouseover="showTrickProps(' + "'{1}'" + ')" onmouseout="hidePopup()" />', path, name, iname);
if (onclick != '')
{
html = '<a href="#" onclick="' + onclick + '">' + html + '</a>';
}
return html;
}
function getTrickImageHtml(state, name, onclick, width, id)
{
var rhtml = '<td';
if (id != null)
{
rhtml += ' id="' + getFullTrickId(state, id) + '"';
}
rhtml += ' width="' + width + '">' + getTrickImageHtml_Core(name, onclick, width, id) + '</td>';
return rhtml;
}
function getSingleTrickSlotHtml(state, trickNumber, trickSlotData)
{
var onclick = 'hideMenu(); onChooseTrick(' + trickNumber + '); return false';
return getTrickImageHtml(state, trickSlotData, onclick, 40, trickNumber);
}
function updateSingleTrickSlotHtml(trickNumber)
{
var state = activeState;
if (state == null)
{
return;
}
var onclick = 'hideMenu(); onChooseTrick(' + trickNumber + '); return false';
var html = getTrickImageHtml_Core(state.trickSlots[trickNumber], onclick, 40, trickNumber);
document.getElementById(getFullTrickId(state, trickNumber)).innerHTML = html;
fastUpdateDresserState(activeState);
}
function onChooseTrick_InCat(trickNumber, catno)
{
var state = activeState;
if (state == null)
{
return;
}
var tableWidth = (8 * 60);
var perRow = (tableWidth / 40);
//var ftricks = getFilteredTricks(state, catno);
var ftricks = getAllTricks(state, catno);
var menuHtml = format('<b>{0}</b>', trickCategories[catno].caption);
menuHtml += '<table cellspacing="0" width="' + tableWidth + '" cellpadding="0" border="0"><tr><td>';
menuHtml += '<table style="table-layout:fixed;" cellspacing="1" width="' + tableWidth + '" cellpadding="1" border="0"><tr>';
for (var i = 0; i < ftricks.length; i++)
{
var onclick = format("hideMenu(); onWearTrick({1}, '{0}'); return false", ftricks[i].name, trickNumber);
menuHtml += getTrickImageHtml(state, ftricks[i].name, onclick, 40);
if ((i % perRow) == (perRow - 1))
{
menuHtml += '</tr><tr>';
}
}
menuHtml += '</tr></table>';
menuHtml += '</td></tr><tr><td>';
menuHtml += '<hr class="dashed" />';
menuHtml += '</td></tr>';
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
showMenu(menuHtml);
}
function onChooseTrick(trickNumber)
{
var state = activeState;
if (state == null)
{
return;
}
var menuHtml = format('<b>{0}</b>', localizer.tricks);
menuHtml += '<table cellspacing="0" cellpadding="0" border="0">';
for (var i = 0; i < trickCategories.length; i++)
{
//var ftricks = getFilteredTricks(state, i);
var ftricks = getAllTricks(state, i);
if (ftricks.length == 0) continue;
var onclick = format("hideMenu(); onChooseTrick_InCat({0}, {1}); return false", trickNumber, i);
menuHtml += getRowMenuItemHtml(
trickCategories[i].caption,
onclick
);
}
if (state.trickSlots[trickNumber] != null)
{
menuHtml += getRowMenuSeparatorHtml();
var onclick = format("hideMenu(); onWearTrick({0})", trickNumber);
menuHtml += getRowMenuItemHtml(localizer.dropTrick, onclick);
}
var AnyTricksOn=0;
for (var i=0; i<state.trickSlots.length; i++)
{ if (state.trickSlots[i] != null) { AnyTricksOn = 1; } }
if ( AnyTricksOn == 1)
{
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.HideAllTricks, 'onWearTrickAll()');
}
menuHtml += getRowMenuSeparatorHtml();
menuHtml += getRowMenuItemHtml(localizer.closeMenu, 'hideMenu()');
menuHtml += '</table>';
cursorY -= 60;
showMenu(menuHtml);
}
function onWearTrick(trickNumber, name)
{
var state = activeState;
if (state == null)
{
return;
}
state.trickSlots[trickNumber] = name;
updateSingleTrickSlotHtml(trickNumber);
}
function onWearTrickAll()
{
var state = activeState;
if (state == null)
{
return;
}
for (var i=0; i<state.trickSlots.length; i++)
{
if (state.trickSlots[i] != null)
{
state.trickSlots[i] = null;
updateSingleTrickSlotHtml(i);
}
}
}
function getSimplePersObjectImageHtml(state, slot)
{
var r;
var style = 'filter:';
var objid = state.objects[slot.index];
var oimg = (objid == null) ? slot.id : objid;
var o = getObjectByStateSlot(state, slot);
var filter = getObjectFilter(state, slot, o);
style += getRealFilter(filter);
r = '<td valign="top">';
var realItemImgPath = getRealImagePath(objid, slot);
r += format(
'<img name="x{1}" src="{0}{1}.gif" width="{2}" height="{3}" style="{4}" border="0" />',
realItemImgPath,
oimg,
slot.width,
slot.height,
style
);
r += '</td>';
return r;
}
function onUseTrick(trickNumber)
{
// does nothing yet.
}
function getSimplePersImageHtml(state, showTricks)
{
var oimg;
var i;
var hp = ('hitpoints' in state.inbattle) ? state.inbattle.hitpoints : 0;
var mhp = ('hitpoints' in state.results) ? state.results.hitpoints : 0;
hp = hp.toString();
hp = hp + '/' + mhp;
var r = '';
r += '<table border="0" cellspacing="0" cellpadding="0"';
if (state.sign != '')
{
r += ' style="background-image: url(';
r += zodiacImgPath + state.sign;
r += '.gif); background-repeat: no-repeat; background-position: top right;"';
}
r += '>';
r += format('<tr><td id="{1}{0}" align="center" >{2}</td></tr>', state.id, 'nick', getPersNickString(state));
r += format('<tr><td id="{1}{0}" width="240" align="right" nowrap="yes" style="font-size: 10px;">', state.id, hpMeterSuffix);
r += format('<span id="{1}{0}v">{2}</span> ', state.id, hpMeterSuffix, hp);
var w = 240 - ((hp.length + 2) * 7);
r += format('<img id="{4}{3}i" src="{0}" width="{2}" height="8" alt="{1} (100%)" border="0" />', hpMeterGreenImg, getItemPropLabel('hitpoints'), w, state.id, hpMeterSuffix);
r += format('<img src="{0}herz.gif" width="10" height="9" alt="{1}"/>', baseImgPath, getItemPropLabel('hitpoints'));
var mana = ('mana' in state.inbattle) ? state.inbattle.mana : 0;
var mmana = ('mana' in state.results) ? state.results.mana : 0;
mana = mana.toString();
mana = mana + '/' + mmana;
var manaDisplayMode = (mmana > 0) ? '' : 'none';
r += format('</td></tr><tr><td id="{1}{0}" width="240" align="right" nowrap="yes" style="font-size: 10px; display: {2}">', state.id, manaMeterSuffix, manaDisplayMode);
r += format('<span id="{1}{0}v">{2}</span> ', state.id, manaMeterSuffix, mana);
w = 240 - ((mana.length + 2) * 7);
r += format('<img id="{4}{3}i" src="{0}" width="{2}" height="8" alt="{1} (100%)" border="0" />', manaMeterImg, getItemPropLabel('mana'), w, state.id, manaMeterSuffix);
r += format('<img src="{0}Mherz.gif" width="10" height="9" alt="{1}"/>', baseImgPath, getItemPropLabel('mana'));
r += '</td></tr><tr height="4"><td height="4"></td></tr>';
if (showTricks)
{
r += '<tr><td><table border="0" cellspacing="0" cellpadding="0"><tr>';
// w100 - w109
for (i = 100; i < 105; i++)
{
r += getSimplePersObjectImageHtml(state, getSlotById('w' + i));
}
// this slot is handled as book slot.
r += getSimplePersObjectImageHtml(state, slot_wbook);
// r += format('<td><img style="filter:alpha(opacity = 40, style = 3)" src="{0}w{1}.gif" width="40" height="25" border="0" /></td>', itemImgPath, 109);
r += '</tr><tr>';
for (i = 105; i < 110; i++)
{
r += getSimplePersObjectImageHtml(state, getSlotById('w' + i));
}
// this slot is handled separately like as BK.
r += format('<td><img style="opacity: 0.4; MozOpacity: 0.4; KhtmlOpacity: 0.4; filter:alpha(opacity = 40, style = 3)" src="{0}w{1}.gif" width="40" height="25" border="0" /></td>', itemImgPath, 109);
r += '</tr></table></td></tr>';
}
r += '<tr><td><table border="0" cellspacing="0" cellpadding="0"><tr><td width="60"><table width="60" border="0" cellpadding="0" cellspacing="0"><tr>';
// w9
r += getSimplePersObjectImageHtml(state, slot_w9);
r += '</tr><tr>';
// w13
r += getSimplePersObjectImageHtml(state, slot_w13);
r += '</tr><tr>';
// w3
r += getSimplePersObjectImageHtml(state, slot_w3);
r += '</tr><tr>';
// w4
r += getSimplePersObjectImageHtml(state, slot_w4);
r += '</tr><tr>';
// w5
r += getSimplePersObjectImageHtml(state, slot_w5);
r += '</tr></table></td>';
r += '<td width="120"><table width="120" border="0" cellpadding="0" cellspacing="0"><tr><td colspan="3" height="220" align="right" valign="bottom" style="background-image:url(';
r += charImgPath + state.sex + '/' + state.image;
r += '.gif); background-repeat: no-repeat; background-position: center center;">';
if (state.pet != null)
{
var pet = pets[state.pet.n];
r += format('<img src="{0}{2}/{1}.gif" alt="" title="" onmouseover="showPetProps(event)" onclick="javascript: ;" onmouseout="hidePopup()" width="40" height="73" border="0" />', charImgPath, pet.image.def, pet.image.sex);
}
r += '</td></tr><tr>';
r += getSimplePersObjectImageHtml(state, slot_w14);
// w16 is skipped
r += format('<td height="20"><img style="opacity: 0.4; MozOpacity: 0.4;KhtmlOpacity: 0.4; filter:alpha(opacity = 40, style = 3)" src="{0}w14.gif" width="40" height="20" border="0" /></td>', itemImgPath);
r += getSimplePersObjectImageHtml(state, slot_w15);
r += '</tr><tr>';
r += format('<td height="20"><img style="opacity: 0.4; MozOpacity: 0.4;KhtmlOpacity: 0.4; filter:alpha(opacity = 40, style = 3)" src="{0}w20_1.gif" width="40" height="20" border="0" /></td>', itemImgPath);
r += format('<td height="20"><img style="opacity: 0.4; MozOpacity: 0.4;KhtmlOpacity: 0.4; filter:alpha(opacity = 40, style = 3)" src="{0}w20_1.gif" width="40" height="20" border="0" /></td>', itemImgPath);
r += format('<td height="20"><img style="opacity: 0.4; MozOpacity: 0.4;KhtmlOpacity: 0.4; filter:alpha(opacity = 40, style = 3)" src="{0}w20_1.gif" width="40" height="20" border="0" /></td>', itemImgPath);
r += '</tr></table></td><td width="60"><table width="60" border="0" cellpadding="0" cellspacing="0"><tr>';
// w1
r += getSimplePersObjectImageHtml(state, slot_w1);
r += '</tr><tr>';
// w2
r += getSimplePersObjectImageHtml(state, slot_w2);
r += '</tr><tr><td><table border="0" cellspacing="0" cellpadding="0"><tr>';
// w6
r += getSimplePersObjectImageHtml(state, slot_w6);
// w7
r += getSimplePersObjectImageHtml(state, slot_w7);
// w8
r += getSimplePersObjectImageHtml(state, slot_w8);
r += '</tr></table></td></tr><tr>';
// w11
r += getSimplePersObjectImageHtml(state, slot_w11);
r += '</tr><tr>';
// w10
r += getSimplePersObjectImageHtml(state, slot_w10);
r += '</tr><tr>';
// w19
r += getSimplePersObjectImageHtml(state, slot_w19);
r += '</tr><tr>';
// w12
r += getSimplePersObjectImageHtml(state, slot_w12);
r += '</tr></table></td>';
r += '<td width="60" valign="bottom"><table width="60" border="0" cellpadding="0" cellspacing="0"><tr>';
// w18
r += getSimplePersObjectImageHtml(state, slot_w18);
r += '</tr><tr>';
// wshirt (w0)
r += getSimplePersObjectImageHtml(state, slot_w0);
r += '</tr><tr>';
// w17
r += getSimplePersObjectImageHtml(state, slot_w17);
r += '</tr></tr></table></td></tr></table></td></tr>';
if (showTricks)
{
r += '<tr><td><table border="0" cellspacing="0" cellpadding="0">';
for (var ci = 0; ci < 2; ci++)
{
r += '<tr>';
for (var i = 0; i < 7; i++)
{
//if (ci==2 && i==6) {continue;}
var trickNumber = (ci * 7) + i;
var onclick = 'hideMenu(); onUseTrick(' + trickNumber + '); return false';
r += getTrickImageHtml(state, state.trickSlots[trickNumber], onclick, 50);
}
r += '</tr>';
}
r += '</table></td></tr>';
}
r += '</table>';
return r;
}
function getEmbeddedDresserFrameHtml()
{
return '<IFRAME SRC="/dressroom/counter.php?type=embedded" SCROLLING="no" WIDTH="100%" HEIGHT="100" BORDER="0" />';
}
function getAutoCombatsDresserFrameHtml()
{
return '<IFRAME SRC="/dressroom/counter.php?type=autocombats" SCROLLING="no" WIDTH="100%" HEIGHT="100" BORDER="0" />';
}
function getOfflineDresserFrameHtml()
{
return '<IFRAME SRC="/dressroom/counter.php?type=offline" SCROLLING="no" WIDTH="100%" HEIGHT="100" BORDER="0" />';
}
function initializeDresserForBenderOmsk()
{
dressOptions.benderOmskMode = true;
hereItemImgPath = '';
charImgPath = 'images/';
brandImgPath = 'brand/';
brand2ImgPath = 'misc/';
infospaceImgPath = 'images/infospace/';
dressImgPath = 'dress/';
blankImgPath = 'blank.gif';
zodiacImgPath = 'dress/z/';
saveSetOnServerUrl = absoluteDressRoomUrl + '?action=save&saveset=1&offline=1&texttosave={0}';
}
| 26.918948 | 457 | 0.632122 |
b96bebc0b7b5b09c6b4f6739f3d94d5d7ffc0fe2
| 54,264 |
c
|
C
|
testsuite/EXP_5/test116.c
|
ishiura-compiler/CF3
|
0718aa176d0303a4ea8a46bd6c794997cbb8fabb
|
[
"MIT"
] | 34 |
2017-07-04T14:16:12.000Z
|
2021-04-22T21:04:43.000Z
|
testsuite/EXP_5/test116.c
|
ishiura-compiler/CF3
|
0718aa176d0303a4ea8a46bd6c794997cbb8fabb
|
[
"MIT"
] | 1 |
2017-07-06T03:43:44.000Z
|
2017-07-06T03:43:44.000Z
|
testsuite/EXP_5/test116.c
|
ishiura-compiler/CF3
|
0718aa176d0303a4ea8a46bd6c794997cbb8fabb
|
[
"MIT"
] | 6 |
2017-07-04T16:30:42.000Z
|
2019-10-16T05:37:29.000Z
|
/*
CF3
Copyright (c) 2015 ishiura-lab.
Released under the MIT license.
https://github.com/ishiura-compiler/CF3/MIT-LICENSE.md
*/
#include<stdio.h>
#include<stdint.h>
#include<stdlib.h>
#include"test1.h"
int8_t x13 = -2;
int8_t x14 = 2;
static volatile int32_t t0 = 80682128;
int32_t t1 = INT32_MIN;
uint8_t x45 = UINT8_MAX;
volatile uint64_t x46 = 4783864216455096LLU;
int64_t x122 = -1LL;
uint16_t x123 = 881U;
int32_t x141 = 5;
volatile int8_t x146 = -1;
static uint8_t x147 = 87U;
uint16_t x155 = 3U;
int8_t x202 = INT8_MIN;
int8_t x205 = -3;
volatile int32_t t15 = 25559462;
int32_t x227 = -1;
int32_t x231 = 13;
int16_t x232 = INT16_MIN;
int32_t x239 = INT32_MIN;
uint32_t t20 = 1839137U;
int16_t x250 = 7537;
uint16_t x251 = 24201U;
volatile int32_t x254 = INT32_MIN;
volatile int32_t t23 = 51;
static uint64_t t26 = UINT64_MAX;
int8_t x326 = 0;
int16_t x329 = -1;
static int16_t x341 = INT16_MAX;
static volatile int32_t t31 = -25;
volatile int64_t x355 = INT64_MIN;
int32_t x360 = -1;
uint32_t x382 = 0U;
int32_t t36 = -509617;
static uint16_t x392 = 61U;
static int8_t x471 = -1;
static int8_t x481 = 6;
int8_t x483 = INT8_MIN;
int32_t t43 = -2;
int32_t t44 = 112089;
int16_t x495 = INT16_MAX;
static uint16_t x505 = UINT16_MAX;
int32_t t48 = 950740;
static int32_t x530 = 1096453;
static int32_t t51 = -20;
volatile int32_t x564 = INT32_MIN;
int8_t x565 = INT8_MAX;
volatile uint8_t x570 = UINT8_MAX;
int16_t x574 = -959;
volatile int64_t x579 = 234LL;
int32_t t56 = -241105;
uint32_t x585 = 1005264602U;
static int16_t x594 = INT16_MIN;
uint64_t t60 = 767LLU;
int64_t x624 = INT64_MIN;
int16_t x640 = -5328;
int64_t x642 = -2384005192LL;
int16_t x645 = -1;
volatile int8_t x649 = INT8_MIN;
int64_t x715 = INT64_MIN;
int16_t x719 = -5269;
int32_t x730 = 208;
int8_t x734 = 0;
uint16_t x741 = 26U;
int8_t x742 = INT8_MIN;
static int32_t t73 = -1063;
int16_t x752 = INT16_MIN;
volatile int8_t x792 = -12;
int32_t x793 = INT32_MAX;
int16_t x809 = INT16_MIN;
int32_t t78 = -40;
int32_t x817 = INT32_MIN;
uint32_t x827 = UINT32_MAX;
int16_t x828 = -8097;
volatile int16_t x860 = -490;
int16_t x862 = INT16_MIN;
int16_t x863 = INT16_MAX;
volatile int64_t x880 = -1LL;
volatile int16_t x905 = -254;
static volatile int32_t t88 = -32343;
static int32_t x909 = 1776931;
int8_t x910 = INT8_MIN;
int64_t x912 = 134295234044297LL;
int32_t t89 = -1;
static int32_t x925 = INT32_MAX;
static volatile int16_t x940 = -1;
uint64_t x947 = 318091128726940751LLU;
static volatile int32_t t93 = -13558586;
uint64_t x973 = 1LLU;
int8_t x974 = 0;
static int64_t x977 = INT64_MIN;
volatile int64_t t96 = INT64_MIN;
int32_t x984 = 5;
int64_t t103 = -132324110859LL;
volatile uint32_t t104 = UINT32_MAX;
static int64_t x1093 = 725970023004073110LL;
int16_t x1096 = INT16_MAX;
volatile int64_t t105 = -26075LL;
volatile uint16_t x1115 = 397U;
uint64_t x1132 = 45111LLU;
uint8_t x1139 = 95U;
static volatile int32_t t109 = -4104928;
static volatile int32_t t110 = -929964253;
uint8_t x1168 = 1U;
static volatile uint16_t x1176 = 7U;
uint8_t x1218 = 0U;
static int8_t x1219 = 3;
volatile uint32_t t119 = UINT32_MAX;
int64_t x1257 = -64553266813716LL;
int8_t x1259 = 0;
uint8_t x1271 = UINT8_MAX;
static volatile int64_t x1272 = INT64_MIN;
volatile int32_t t122 = 128981848;
uint8_t x1280 = UINT8_MAX;
uint32_t x1301 = UINT32_MAX;
int16_t x1302 = INT16_MAX;
int16_t x1344 = INT16_MAX;
int32_t t130 = -9009;
volatile uint16_t x1371 = 8U;
uint8_t x1387 = 7U;
int32_t x1388 = -358183;
uint16_t x1398 = UINT16_MAX;
int16_t x1400 = 732;
static int64_t t134 = -4030LL;
static volatile int8_t x1418 = INT8_MIN;
volatile int32_t t136 = INT32_MIN;
volatile int16_t x1439 = INT16_MIN;
static int32_t x1453 = INT32_MAX;
uint8_t x1455 = 5U;
int8_t x1467 = INT8_MIN;
volatile int32_t x1472 = INT32_MIN;
int64_t t140 = 33702717359LL;
static uint32_t x1478 = 8089U;
volatile int8_t x1497 = INT8_MIN;
static int32_t t143 = 410245440;
int16_t x1522 = -30;
int32_t t148 = -40734990;
int8_t x1565 = INT8_MIN;
int32_t x1568 = INT32_MIN;
uint64_t x1570 = UINT64_MAX;
static int16_t x1581 = INT16_MIN;
int64_t x1585 = 6911963625497630LL;
volatile int64_t t155 = 17487085046406098LL;
uint8_t x1592 = 113U;
uint64_t x1611 = 1494063233575LLU;
int64_t x1618 = -1LL;
static int8_t x1619 = 4;
uint8_t x1620 = 1U;
volatile int16_t x1631 = -1;
int16_t x1634 = INT16_MAX;
static int32_t x1635 = -1;
volatile uint64_t t160 = 50328984079381LLU;
int32_t t161 = 670;
static uint8_t x1659 = 1U;
int32_t t162 = 76758;
int64_t x1664 = INT64_MIN;
uint8_t x1676 = UINT8_MAX;
static int32_t x1690 = 324435;
uint16_t x1694 = 3179U;
int32_t t167 = 0;
int16_t x1699 = INT16_MIN;
int32_t x1700 = INT32_MIN;
int8_t x1708 = INT8_MIN;
volatile int8_t x1711 = 0;
uint8_t x1759 = 20U;
static int32_t x1777 = 1;
uint64_t x1791 = 85750322LLU;
uint32_t x1792 = 381720U;
static uint16_t x1808 = 106U;
uint32_t x1815 = UINT32_MAX;
volatile int32_t t182 = -1555;
int64_t x1827 = 62553992400953LL;
uint64_t x1835 = 19140964720616441LLU;
int8_t x1850 = INT8_MIN;
static uint8_t x1851 = 7U;
volatile uint32_t x1852 = 94U;
int32_t t186 = INT32_MIN;
int16_t x1867 = -1;
static volatile int64_t t189 = INT64_MIN;
volatile uint32_t x1914 = UINT32_MAX;
volatile int64_t t192 = INT64_MIN;
uint32_t x1925 = 313463U;
static int16_t x1927 = INT16_MAX;
static volatile uint32_t t195 = 27924U;
static volatile int32_t t196 = -3720;
int32_t x1942 = 29635;
int32_t x1943 = -179;
static int64_t t197 = INT64_MAX;
void f0(void) {
uint16_t x15 = UINT16_MAX;
volatile int8_t x16 = -48;
t0 = (x13/((x14+x15)>x16));
if (t0 != -2) { NG(); } else { ; }
}
void f1(void) {
static volatile int32_t x41 = INT32_MIN;
int16_t x42 = INT16_MAX;
int16_t x43 = INT16_MIN;
volatile int32_t x44 = -154427407;
t1 = (x41/((x42+x43)>x44));
if (t1 != INT32_MIN) { NG(); } else { ; }
}
void f2(void) {
int64_t x47 = INT64_MAX;
static int64_t x48 = INT64_MIN;
volatile int32_t t2 = 17;
t2 = (x45/((x46+x47)>x48));
if (t2 != 255) { NG(); } else { ; }
}
void f3(void) {
int16_t x53 = INT16_MIN;
int32_t x54 = INT32_MAX;
int32_t x55 = INT32_MIN;
uint32_t x56 = 10308U;
static int32_t t3 = 32622;
t3 = (x53/((x54+x55)>x56));
if (t3 != -32768) { NG(); } else { ; }
}
void f4(void) {
static int8_t x89 = 0;
static uint64_t x90 = UINT64_MAX;
int32_t x91 = INT32_MIN;
int8_t x92 = 9;
volatile int32_t t4 = -1;
t4 = (x89/((x90+x91)>x92));
if (t4 != 0) { NG(); } else { ; }
}
void f5(void) {
static uint64_t x117 = UINT64_MAX;
int64_t x118 = INT64_MIN;
volatile uint64_t x119 = 15398LLU;
static uint32_t x120 = 1760659U;
static uint64_t t5 = UINT64_MAX;
t5 = (x117/((x118+x119)>x120));
if (t5 != UINT64_MAX) { NG(); } else { ; }
}
void f6(void) {
uint32_t x121 = UINT32_MAX;
volatile int64_t x124 = INT64_MIN;
uint32_t t6 = UINT32_MAX;
t6 = (x121/((x122+x123)>x124));
if (t6 != UINT32_MAX) { NG(); } else { ; }
}
void f7(void) {
int32_t x125 = 29;
static int8_t x126 = INT8_MAX;
int8_t x127 = INT8_MIN;
uint32_t x128 = 17179U;
int32_t t7 = 31;
t7 = (x125/((x126+x127)>x128));
if (t7 != 29) { NG(); } else { ; }
}
void f8(void) {
uint64_t x142 = 7608304LLU;
volatile uint8_t x143 = 42U;
volatile uint16_t x144 = 3061U;
int32_t t8 = -49;
t8 = (x141/((x142+x143)>x144));
if (t8 != 5) { NG(); } else { ; }
}
void f9(void) {
uint8_t x145 = UINT8_MAX;
static uint16_t x148 = 31U;
volatile int32_t t9 = 117326012;
t9 = (x145/((x146+x147)>x148));
if (t9 != 255) { NG(); } else { ; }
}
void f10(void) {
static uint16_t x153 = UINT16_MAX;
uint16_t x154 = UINT16_MAX;
int16_t x156 = INT16_MIN;
volatile int32_t t10 = 763536365;
t10 = (x153/((x154+x155)>x156));
if (t10 != 65535) { NG(); } else { ; }
}
void f11(void) {
static uint8_t x173 = 0U;
int16_t x174 = INT16_MIN;
int32_t x175 = INT32_MAX;
uint8_t x176 = 3U;
int32_t t11 = -1;
t11 = (x173/((x174+x175)>x176));
if (t11 != 0) { NG(); } else { ; }
}
void f12(void) {
uint8_t x181 = 12U;
int32_t x182 = -2029;
uint16_t x183 = 20433U;
uint8_t x184 = UINT8_MAX;
int32_t t12 = 7089;
t12 = (x181/((x182+x183)>x184));
if (t12 != 12) { NG(); } else { ; }
}
void f13(void) {
int32_t x197 = INT32_MAX;
static int64_t x198 = 151289873478LL;
int16_t x199 = INT16_MAX;
uint64_t x200 = 2838LLU;
static volatile int32_t t13 = INT32_MAX;
t13 = (x197/((x198+x199)>x200));
if (t13 != INT32_MAX) { NG(); } else { ; }
}
void f14(void) {
volatile uint32_t x201 = 61126343U;
int64_t x203 = 213335LL;
volatile uint32_t x204 = 6U;
volatile uint32_t t14 = 28U;
t14 = (x201/((x202+x203)>x204));
if (t14 != 61126343U) { NG(); } else { ; }
}
void f15(void) {
static int32_t x206 = -481330957;
uint32_t x207 = UINT32_MAX;
static int64_t x208 = INT64_MIN;
t15 = (x205/((x206+x207)>x208));
if (t15 != -3) { NG(); } else { ; }
}
void f16(void) {
uint32_t x209 = 28239680U;
uint8_t x210 = 7U;
uint16_t x211 = UINT16_MAX;
int64_t x212 = INT64_MIN;
uint32_t t16 = 54209900U;
t16 = (x209/((x210+x211)>x212));
if (t16 != 28239680U) { NG(); } else { ; }
}
void f17(void) {
uint16_t x217 = 1730U;
int64_t x218 = 82456527739LL;
uint16_t x219 = 1U;
static int8_t x220 = -1;
static int32_t t17 = -15923263;
t17 = (x217/((x218+x219)>x220));
if (t17 != 1730) { NG(); } else { ; }
}
void f18(void) {
volatile int64_t x225 = INT64_MIN;
int16_t x226 = INT16_MIN;
static int64_t x228 = INT64_MIN;
static int64_t t18 = INT64_MIN;
t18 = (x225/((x226+x227)>x228));
if (t18 != INT64_MIN) { NG(); } else { ; }
}
void f19(void) {
volatile int16_t x229 = INT16_MIN;
uint16_t x230 = 6555U;
int32_t t19 = -1;
t19 = (x229/((x230+x231)>x232));
if (t19 != -32768) { NG(); } else { ; }
}
void f20(void) {
volatile uint32_t x237 = 515701047U;
static uint16_t x238 = 213U;
volatile int64_t x240 = INT64_MIN;
t20 = (x237/((x238+x239)>x240));
if (t20 != 515701047U) { NG(); } else { ; }
}
void f21(void) {
int16_t x249 = 17;
static uint8_t x252 = UINT8_MAX;
int32_t t21 = 129048155;
t21 = (x249/((x250+x251)>x252));
if (t21 != 17) { NG(); } else { ; }
}
void f22(void) {
int8_t x253 = INT8_MIN;
volatile uint8_t x255 = 7U;
uint32_t x256 = 2036U;
volatile int32_t t22 = -3;
t22 = (x253/((x254+x255)>x256));
if (t22 != -128) { NG(); } else { ; }
}
void f23(void) {
static int8_t x261 = INT8_MIN;
volatile int16_t x262 = INT16_MIN;
volatile int64_t x263 = -1LL;
int64_t x264 = INT64_MIN;
t23 = (x261/((x262+x263)>x264));
if (t23 != -128) { NG(); } else { ; }
}
void f24(void) {
static int8_t x269 = INT8_MAX;
static int8_t x270 = 5;
static uint16_t x271 = 85U;
int16_t x272 = -1;
volatile int32_t t24 = -28006;
t24 = (x269/((x270+x271)>x272));
if (t24 != 127) { NG(); } else { ; }
}
void f25(void) {
int64_t x285 = INT64_MIN;
int64_t x286 = -1LL;
volatile int32_t x287 = INT32_MIN;
uint64_t x288 = 27404166577865331LLU;
static volatile int64_t t25 = INT64_MIN;
t25 = (x285/((x286+x287)>x288));
if (t25 != INT64_MIN) { NG(); } else { ; }
}
void f26(void) {
static uint64_t x297 = UINT64_MAX;
volatile uint32_t x298 = UINT32_MAX;
volatile int32_t x299 = -1;
int64_t x300 = INT64_MIN;
t26 = (x297/((x298+x299)>x300));
if (t26 != UINT64_MAX) { NG(); } else { ; }
}
void f27(void) {
volatile int32_t x321 = -1;
static int32_t x322 = INT32_MIN;
volatile uint64_t x323 = UINT64_MAX;
int16_t x324 = INT16_MAX;
static volatile int32_t t27 = -45663;
t27 = (x321/((x322+x323)>x324));
if (t27 != -1) { NG(); } else { ; }
}
void f28(void) {
static int32_t x325 = INT32_MAX;
int32_t x327 = -1;
int32_t x328 = -198525;
int32_t t28 = INT32_MAX;
t28 = (x325/((x326+x327)>x328));
if (t28 != INT32_MAX) { NG(); } else { ; }
}
void f29(void) {
int8_t x330 = -1;
int16_t x331 = 1868;
int32_t x332 = 162;
int32_t t29 = -296971274;
t29 = (x329/((x330+x331)>x332));
if (t29 != -1) { NG(); } else { ; }
}
void f30(void) {
int64_t x337 = 991148017LL;
static int16_t x338 = 34;
int8_t x339 = -17;
int64_t x340 = -1LL;
int64_t t30 = 40218846661LL;
t30 = (x337/((x338+x339)>x340));
if (t30 != 991148017LL) { NG(); } else { ; }
}
void f31(void) {
int16_t x342 = -1;
uint32_t x343 = 1725034541U;
static uint8_t x344 = 5U;
t31 = (x341/((x342+x343)>x344));
if (t31 != 32767) { NG(); } else { ; }
}
void f32(void) {
uint64_t x353 = 1111289430722619778LLU;
uint32_t x354 = UINT32_MAX;
uint64_t x356 = 1766636688090225LLU;
uint64_t t32 = 5260313487157569630LLU;
t32 = (x353/((x354+x355)>x356));
if (t32 != 1111289430722619778LLU) { NG(); } else { ; }
}
void f33(void) {
int64_t x357 = INT64_MIN;
int64_t x358 = -1LL;
static volatile uint8_t x359 = 122U;
volatile int64_t t33 = INT64_MIN;
t33 = (x357/((x358+x359)>x360));
if (t33 != INT64_MIN) { NG(); } else { ; }
}
void f34(void) {
volatile int32_t x361 = INT32_MAX;
static int16_t x362 = INT16_MAX;
int16_t x363 = INT16_MIN;
int16_t x364 = -6032;
static volatile int32_t t34 = INT32_MAX;
t34 = (x361/((x362+x363)>x364));
if (t34 != INT32_MAX) { NG(); } else { ; }
}
void f35(void) {
int16_t x369 = INT16_MIN;
static volatile int32_t x370 = INT32_MIN;
static volatile int64_t x371 = 533089993259403492LL;
volatile uint16_t x372 = 2U;
static volatile int32_t t35 = -584616;
t35 = (x369/((x370+x371)>x372));
if (t35 != -32768) { NG(); } else { ; }
}
void f36(void) {
static int32_t x381 = 749075;
volatile int64_t x383 = 3916596404164812LL;
uint16_t x384 = 1647U;
t36 = (x381/((x382+x383)>x384));
if (t36 != 749075) { NG(); } else { ; }
}
void f37(void) {
static volatile int8_t x389 = -1;
static int32_t x390 = -213;
int16_t x391 = INT16_MAX;
static int32_t t37 = 24057671;
t37 = (x389/((x390+x391)>x392));
if (t37 != -1) { NG(); } else { ; }
}
void f38(void) {
uint32_t x405 = 540869256U;
int8_t x406 = INT8_MIN;
uint32_t x407 = UINT32_MAX;
int8_t x408 = INT8_MAX;
volatile uint32_t t38 = 26404U;
t38 = (x405/((x406+x407)>x408));
if (t38 != 540869256U) { NG(); } else { ; }
}
void f39(void) {
int32_t x421 = INT32_MAX;
int8_t x422 = 1;
static uint8_t x423 = UINT8_MAX;
int16_t x424 = -946;
volatile int32_t t39 = INT32_MAX;
t39 = (x421/((x422+x423)>x424));
if (t39 != INT32_MAX) { NG(); } else { ; }
}
void f40(void) {
int16_t x465 = 4;
uint32_t x466 = 1548433U;
uint16_t x467 = 9U;
volatile int8_t x468 = INT8_MAX;
static int32_t t40 = -1011138;
t40 = (x465/((x466+x467)>x468));
if (t40 != 4) { NG(); } else { ; }
}
void f41(void) {
volatile int32_t x469 = INT32_MIN;
uint16_t x470 = 10839U;
volatile uint8_t x472 = UINT8_MAX;
volatile int32_t t41 = INT32_MIN;
t41 = (x469/((x470+x471)>x472));
if (t41 != INT32_MIN) { NG(); } else { ; }
}
void f42(void) {
int64_t x477 = INT64_MAX;
volatile int8_t x478 = 0;
int8_t x479 = INT8_MIN;
volatile int64_t x480 = INT64_MIN;
volatile int64_t t42 = INT64_MAX;
t42 = (x477/((x478+x479)>x480));
if (t42 != INT64_MAX) { NG(); } else { ; }
}
void f43(void) {
uint32_t x482 = 21U;
int32_t x484 = INT32_MAX;
t43 = (x481/((x482+x483)>x484));
if (t43 != 6) { NG(); } else { ; }
}
void f44(void) {
static volatile uint8_t x489 = UINT8_MAX;
volatile int16_t x490 = -54;
uint16_t x491 = UINT16_MAX;
int16_t x492 = -1;
t44 = (x489/((x490+x491)>x492));
if (t44 != 255) { NG(); } else { ; }
}
void f45(void) {
int8_t x493 = INT8_MAX;
int64_t x494 = -1LL;
volatile int64_t x496 = 10695LL;
volatile int32_t t45 = -55279640;
t45 = (x493/((x494+x495)>x496));
if (t45 != 127) { NG(); } else { ; }
}
void f46(void) {
static volatile int32_t x497 = INT32_MAX;
int32_t x498 = INT32_MIN;
static uint64_t x499 = 9472433063LLU;
uint32_t x500 = 506112860U;
volatile int32_t t46 = INT32_MAX;
t46 = (x497/((x498+x499)>x500));
if (t46 != INT32_MAX) { NG(); } else { ; }
}
void f47(void) {
uint32_t x506 = 5U;
uint16_t x507 = UINT16_MAX;
static int64_t x508 = INT64_MIN;
int32_t t47 = 120;
t47 = (x505/((x506+x507)>x508));
if (t47 != 65535) { NG(); } else { ; }
}
void f48(void) {
uint8_t x513 = 50U;
volatile int8_t x514 = -1;
static int8_t x515 = INT8_MIN;
uint64_t x516 = 689896379701704LLU;
t48 = (x513/((x514+x515)>x516));
if (t48 != 50) { NG(); } else { ; }
}
void f49(void) {
static int16_t x517 = -172;
int16_t x518 = INT16_MIN;
int32_t x519 = INT32_MAX;
int8_t x520 = 1;
volatile int32_t t49 = -2558;
t49 = (x517/((x518+x519)>x520));
if (t49 != -172) { NG(); } else { ; }
}
void f50(void) {
volatile uint32_t x529 = UINT32_MAX;
int8_t x531 = INT8_MIN;
static int64_t x532 = 110LL;
uint32_t t50 = UINT32_MAX;
t50 = (x529/((x530+x531)>x532));
if (t50 != UINT32_MAX) { NG(); } else { ; }
}
void f51(void) {
static int8_t x533 = INT8_MIN;
static int8_t x534 = -6;
int16_t x535 = INT16_MAX;
static volatile int16_t x536 = -1;
t51 = (x533/((x534+x535)>x536));
if (t51 != -128) { NG(); } else { ; }
}
void f52(void) {
int16_t x561 = -1;
int16_t x562 = 315;
static int8_t x563 = INT8_MIN;
volatile int32_t t52 = 238;
t52 = (x561/((x562+x563)>x564));
if (t52 != -1) { NG(); } else { ; }
}
void f53(void) {
int16_t x566 = 0;
uint32_t x567 = UINT32_MAX;
int8_t x568 = -2;
int32_t t53 = 30;
t53 = (x565/((x566+x567)>x568));
if (t53 != 127) { NG(); } else { ; }
}
void f54(void) {
int64_t x569 = -1LL;
volatile uint64_t x571 = 34185050402803LLU;
int8_t x572 = INT8_MAX;
static int64_t t54 = 43797434LL;
t54 = (x569/((x570+x571)>x572));
if (t54 != -1LL) { NG(); } else { ; }
}
void f55(void) {
uint64_t x573 = 637280581184119LLU;
volatile int16_t x575 = INT16_MAX;
int8_t x576 = INT8_MIN;
volatile uint64_t t55 = 231581580587554512LLU;
t55 = (x573/((x574+x575)>x576));
if (t55 != 637280581184119LLU) { NG(); } else { ; }
}
void f56(void) {
int8_t x577 = -1;
int8_t x578 = INT8_MIN;
uint64_t x580 = 3LLU;
t56 = (x577/((x578+x579)>x580));
if (t56 != -1) { NG(); } else { ; }
}
void f57(void) {
uint8_t x586 = 52U;
uint8_t x587 = 0U;
int64_t x588 = INT64_MIN;
volatile uint32_t t57 = 6U;
t57 = (x585/((x586+x587)>x588));
if (t57 != 1005264602U) { NG(); } else { ; }
}
void f58(void) {
static uint32_t x593 = 3U;
int16_t x595 = INT16_MIN;
static volatile int64_t x596 = INT64_MIN;
uint32_t t58 = 25U;
t58 = (x593/((x594+x595)>x596));
if (t58 != 3U) { NG(); } else { ; }
}
void f59(void) {
int8_t x597 = -4;
uint8_t x598 = 1U;
static volatile uint32_t x599 = 667440525U;
int8_t x600 = 3;
volatile int32_t t59 = -11571;
t59 = (x597/((x598+x599)>x600));
if (t59 != -4) { NG(); } else { ; }
}
void f60(void) {
uint64_t x601 = 167721379792LLU;
uint32_t x602 = 0U;
int64_t x603 = 1LL;
volatile int64_t x604 = INT64_MIN;
t60 = (x601/((x602+x603)>x604));
if (t60 != 167721379792LLU) { NG(); } else { ; }
}
void f61(void) {
int64_t x605 = INT64_MIN;
uint16_t x606 = 8U;
volatile int16_t x607 = -1;
int8_t x608 = INT8_MIN;
int64_t t61 = INT64_MIN;
t61 = (x605/((x606+x607)>x608));
if (t61 != INT64_MIN) { NG(); } else { ; }
}
void f62(void) {
uint16_t x621 = 0U;
int64_t x622 = INT64_MIN;
uint8_t x623 = 3U;
volatile int32_t t62 = 2906447;
t62 = (x621/((x622+x623)>x624));
if (t62 != 0) { NG(); } else { ; }
}
void f63(void) {
uint32_t x637 = 135991837U;
int32_t x638 = -1;
uint32_t x639 = UINT32_MAX;
uint32_t t63 = 58553730U;
t63 = (x637/((x638+x639)>x640));
if (t63 != 135991837U) { NG(); } else { ; }
}
void f64(void) {
int16_t x641 = INT16_MAX;
uint64_t x643 = 3288582030376213035LLU;
uint32_t x644 = UINT32_MAX;
int32_t t64 = 0;
t64 = (x641/((x642+x643)>x644));
if (t64 != 32767) { NG(); } else { ; }
}
void f65(void) {
static int64_t x646 = -1LL;
int32_t x647 = 254581467;
static int16_t x648 = INT16_MIN;
volatile int32_t t65 = -73;
t65 = (x645/((x646+x647)>x648));
if (t65 != -1) { NG(); } else { ; }
}
void f66(void) {
static uint16_t x650 = 765U;
int16_t x651 = -1;
uint8_t x652 = 7U;
volatile int32_t t66 = -126;
t66 = (x649/((x650+x651)>x652));
if (t66 != -128) { NG(); } else { ; }
}
void f67(void) {
uint64_t x685 = 98680611683LLU;
int64_t x686 = INT64_MIN;
uint16_t x687 = 42U;
int64_t x688 = INT64_MIN;
uint64_t t67 = 181514823746LLU;
t67 = (x685/((x686+x687)>x688));
if (t67 != 98680611683LLU) { NG(); } else { ; }
}
void f68(void) {
int32_t x701 = -64;
int8_t x702 = INT8_MIN;
static int8_t x703 = INT8_MIN;
static int32_t x704 = INT32_MIN;
int32_t t68 = -6599;
t68 = (x701/((x702+x703)>x704));
if (t68 != -64) { NG(); } else { ; }
}
void f69(void) {
static volatile uint8_t x713 = 11U;
int16_t x714 = INT16_MAX;
int64_t x716 = INT64_MIN;
volatile int32_t t69 = -27;
t69 = (x713/((x714+x715)>x716));
if (t69 != 11) { NG(); } else { ; }
}
void f70(void) {
int32_t x717 = -1;
int16_t x718 = -54;
uint64_t x720 = 4327243057574612LLU;
static volatile int32_t t70 = 0;
t70 = (x717/((x718+x719)>x720));
if (t70 != -1) { NG(); } else { ; }
}
void f71(void) {
int32_t x729 = -1;
int32_t x731 = -60;
uint16_t x732 = 19U;
static int32_t t71 = -65331;
t71 = (x729/((x730+x731)>x732));
if (t71 != -1) { NG(); } else { ; }
}
void f72(void) {
static volatile int16_t x733 = -4097;
volatile uint16_t x735 = UINT16_MAX;
static int16_t x736 = -5;
int32_t t72 = -95;
t72 = (x733/((x734+x735)>x736));
if (t72 != -4097) { NG(); } else { ; }
}
void f73(void) {
int32_t x743 = INT32_MAX;
int8_t x744 = -1;
t73 = (x741/((x742+x743)>x744));
if (t73 != 26) { NG(); } else { ; }
}
void f74(void) {
volatile uint16_t x749 = 2287U;
int8_t x750 = -1;
int16_t x751 = INT16_MAX;
volatile int32_t t74 = 21457445;
t74 = (x749/((x750+x751)>x752));
if (t74 != 2287) { NG(); } else { ; }
}
void f75(void) {
volatile uint32_t x777 = 453899991U;
volatile uint16_t x778 = UINT16_MAX;
uint64_t x779 = UINT64_MAX;
int64_t x780 = 1721LL;
uint32_t t75 = 8589U;
t75 = (x777/((x778+x779)>x780));
if (t75 != 453899991U) { NG(); } else { ; }
}
void f76(void) {
uint16_t x789 = 14608U;
volatile int16_t x790 = INT16_MIN;
int16_t x791 = INT16_MAX;
volatile int32_t t76 = 1;
t76 = (x789/((x790+x791)>x792));
if (t76 != 14608) { NG(); } else { ; }
}
void f77(void) {
uint8_t x794 = 6U;
uint8_t x795 = 52U;
int8_t x796 = INT8_MIN;
volatile int32_t t77 = INT32_MAX;
t77 = (x793/((x794+x795)>x796));
if (t77 != INT32_MAX) { NG(); } else { ; }
}
void f78(void) {
int16_t x810 = INT16_MIN;
static int64_t x811 = INT64_MAX;
static uint8_t x812 = 0U;
t78 = (x809/((x810+x811)>x812));
if (t78 != -32768) { NG(); } else { ; }
}
void f79(void) {
int64_t x818 = -1LL;
volatile int64_t x819 = INT64_MAX;
volatile int8_t x820 = 0;
int32_t t79 = INT32_MIN;
t79 = (x817/((x818+x819)>x820));
if (t79 != INT32_MIN) { NG(); } else { ; }
}
void f80(void) {
uint32_t x825 = UINT32_MAX;
int8_t x826 = -34;
volatile uint32_t t80 = UINT32_MAX;
t80 = (x825/((x826+x827)>x828));
if (t80 != UINT32_MAX) { NG(); } else { ; }
}
void f81(void) {
int32_t x841 = INT32_MIN;
int8_t x842 = 1;
uint8_t x843 = 30U;
static volatile int8_t x844 = 5;
int32_t t81 = INT32_MIN;
t81 = (x841/((x842+x843)>x844));
if (t81 != INT32_MIN) { NG(); } else { ; }
}
void f82(void) {
static int16_t x857 = INT16_MAX;
static volatile uint32_t x858 = 0U;
volatile uint64_t x859 = UINT64_MAX;
static int32_t t82 = 362213176;
t82 = (x857/((x858+x859)>x860));
if (t82 != 32767) { NG(); } else { ; }
}
void f83(void) {
uint64_t x861 = UINT64_MAX;
volatile int8_t x864 = INT8_MIN;
volatile uint64_t t83 = UINT64_MAX;
t83 = (x861/((x862+x863)>x864));
if (t83 != UINT64_MAX) { NG(); } else { ; }
}
void f84(void) {
volatile uint16_t x869 = 6U;
uint16_t x870 = UINT16_MAX;
int64_t x871 = 1874064707636LL;
int32_t x872 = INT32_MIN;
volatile int32_t t84 = -22530;
t84 = (x869/((x870+x871)>x872));
if (t84 != 6) { NG(); } else { ; }
}
void f85(void) {
uint16_t x877 = 11U;
uint8_t x878 = 85U;
int16_t x879 = INT16_MAX;
volatile int32_t t85 = 2;
t85 = (x877/((x878+x879)>x880));
if (t85 != 11) { NG(); } else { ; }
}
void f86(void) {
uint64_t x889 = 894022904026831LLU;
int64_t x890 = -1LL;
int64_t x891 = 106888093LL;
int8_t x892 = INT8_MIN;
volatile uint64_t t86 = 524228223596181LLU;
t86 = (x889/((x890+x891)>x892));
if (t86 != 894022904026831LLU) { NG(); } else { ; }
}
void f87(void) {
volatile int8_t x901 = INT8_MIN;
int32_t x902 = -1;
int8_t x903 = 3;
int8_t x904 = -23;
int32_t t87 = -29605;
t87 = (x901/((x902+x903)>x904));
if (t87 != -128) { NG(); } else { ; }
}
void f88(void) {
static int8_t x906 = INT8_MIN;
static int8_t x907 = INT8_MIN;
int16_t x908 = INT16_MIN;
t88 = (x905/((x906+x907)>x908));
if (t88 != -254) { NG(); } else { ; }
}
void f89(void) {
int64_t x911 = 65757227951817094LL;
t89 = (x909/((x910+x911)>x912));
if (t89 != 1776931) { NG(); } else { ; }
}
void f90(void) {
int16_t x926 = INT16_MIN;
int8_t x927 = INT8_MIN;
int64_t x928 = -6823710LL;
volatile int32_t t90 = INT32_MAX;
t90 = (x925/((x926+x927)>x928));
if (t90 != INT32_MAX) { NG(); } else { ; }
}
void f91(void) {
uint64_t x937 = 3470LLU;
static volatile int64_t x938 = 0LL;
uint32_t x939 = UINT32_MAX;
volatile uint64_t t91 = 5673332LLU;
t91 = (x937/((x938+x939)>x940));
if (t91 != 3470LLU) { NG(); } else { ; }
}
void f92(void) {
int32_t x941 = INT32_MIN;
static int64_t x942 = -1LL;
int8_t x943 = -2;
int8_t x944 = -14;
volatile int32_t t92 = INT32_MIN;
t92 = (x941/((x942+x943)>x944));
if (t92 != INT32_MIN) { NG(); } else { ; }
}
void f93(void) {
int8_t x945 = INT8_MAX;
volatile int64_t x946 = INT64_MIN;
volatile int32_t x948 = INT32_MAX;
t93 = (x945/((x946+x947)>x948));
if (t93 != 127) { NG(); } else { ; }
}
void f94(void) {
static volatile int8_t x957 = INT8_MAX;
int8_t x958 = -1;
volatile int16_t x959 = -1;
int64_t x960 = INT64_MIN;
int32_t t94 = 225608810;
t94 = (x957/((x958+x959)>x960));
if (t94 != 127) { NG(); } else { ; }
}
void f95(void) {
uint64_t x975 = 1316079964840456LLU;
uint64_t x976 = 724565708582LLU;
uint64_t t95 = 298355653LLU;
t95 = (x973/((x974+x975)>x976));
if (t95 != 1LLU) { NG(); } else { ; }
}
void f96(void) {
uint64_t x978 = 662039118880LLU;
static int32_t x979 = INT32_MIN;
int16_t x980 = 119;
t96 = (x977/((x978+x979)>x980));
if (t96 != INT64_MIN) { NG(); } else { ; }
}
void f97(void) {
int8_t x981 = INT8_MIN;
int64_t x982 = 148944132670254LL;
uint8_t x983 = UINT8_MAX;
volatile int32_t t97 = -852441583;
t97 = (x981/((x982+x983)>x984));
if (t97 != -128) { NG(); } else { ; }
}
void f98(void) {
uint8_t x997 = 1U;
volatile uint64_t x998 = 0LLU;
volatile uint64_t x999 = UINT64_MAX;
static uint64_t x1000 = 1278041LLU;
volatile int32_t t98 = -5364378;
t98 = (x997/((x998+x999)>x1000));
if (t98 != 1) { NG(); } else { ; }
}
void f99(void) {
static int64_t x1005 = 140907027440LL;
static volatile uint64_t x1006 = UINT64_MAX;
int64_t x1007 = -3696748693805LL;
uint64_t x1008 = 33579413326079LLU;
int64_t t99 = -412673LL;
t99 = (x1005/((x1006+x1007)>x1008));
if (t99 != 140907027440LL) { NG(); } else { ; }
}
void f100(void) {
int32_t x1013 = -1;
int8_t x1014 = 0;
volatile int8_t x1015 = INT8_MIN;
volatile int16_t x1016 = INT16_MIN;
static int32_t t100 = 12725;
t100 = (x1013/((x1014+x1015)>x1016));
if (t100 != -1) { NG(); } else { ; }
}
void f101(void) {
int64_t x1045 = -1LL;
volatile int32_t x1046 = 5350688;
uint16_t x1047 = 1U;
uint32_t x1048 = 2984391U;
volatile int64_t t101 = -59858353091372LL;
t101 = (x1045/((x1046+x1047)>x1048));
if (t101 != -1LL) { NG(); } else { ; }
}
void f102(void) {
static int16_t x1057 = -1;
int8_t x1058 = -1;
int8_t x1059 = -1;
uint64_t x1060 = 6702148934727LLU;
volatile int32_t t102 = 427;
t102 = (x1057/((x1058+x1059)>x1060));
if (t102 != -1) { NG(); } else { ; }
}
void f103(void) {
int64_t x1061 = 0LL;
int64_t x1062 = INT64_MAX;
volatile int64_t x1063 = INT64_MIN;
uint64_t x1064 = 85657559664860727LLU;
t103 = (x1061/((x1062+x1063)>x1064));
if (t103 != 0LL) { NG(); } else { ; }
}
void f104(void) {
uint32_t x1065 = UINT32_MAX;
int64_t x1066 = 547303071LL;
int8_t x1067 = 11;
volatile int32_t x1068 = INT32_MIN;
t104 = (x1065/((x1066+x1067)>x1068));
if (t104 != UINT32_MAX) { NG(); } else { ; }
}
void f105(void) {
int32_t x1094 = INT32_MIN;
int64_t x1095 = 50617385716LL;
t105 = (x1093/((x1094+x1095)>x1096));
if (t105 != 725970023004073110LL) { NG(); } else { ; }
}
void f106(void) {
int16_t x1109 = -237;
volatile int32_t x1110 = 429687481;
int32_t x1111 = 115918958;
uint32_t x1112 = 10240U;
int32_t t106 = -5690;
t106 = (x1109/((x1110+x1111)>x1112));
if (t106 != -237) { NG(); } else { ; }
}
void f107(void) {
int64_t x1113 = 6465316LL;
int8_t x1114 = INT8_MIN;
volatile int64_t x1116 = -2933800LL;
static int64_t t107 = 4865346156398975LL;
t107 = (x1113/((x1114+x1115)>x1116));
if (t107 != 6465316LL) { NG(); } else { ; }
}
void f108(void) {
int16_t x1129 = INT16_MAX;
uint64_t x1130 = 227830LLU;
int8_t x1131 = INT8_MIN;
static volatile int32_t t108 = 81;
t108 = (x1129/((x1130+x1131)>x1132));
if (t108 != 32767) { NG(); } else { ; }
}
void f109(void) {
static int16_t x1137 = INT16_MIN;
int32_t x1138 = 3216976;
uint8_t x1140 = UINT8_MAX;
t109 = (x1137/((x1138+x1139)>x1140));
if (t109 != -32768) { NG(); } else { ; }
}
void f110(void) {
int16_t x1149 = -1;
uint16_t x1150 = 369U;
uint8_t x1151 = UINT8_MAX;
int32_t x1152 = INT32_MIN;
t110 = (x1149/((x1150+x1151)>x1152));
if (t110 != -1) { NG(); } else { ; }
}
void f111(void) {
static int32_t x1157 = INT32_MIN;
volatile int16_t x1158 = -100;
volatile int32_t x1159 = -1;
static int16_t x1160 = INT16_MIN;
volatile int32_t t111 = INT32_MIN;
t111 = (x1157/((x1158+x1159)>x1160));
if (t111 != INT32_MIN) { NG(); } else { ; }
}
void f112(void) {
uint32_t x1165 = 2U;
static uint16_t x1166 = 28U;
int8_t x1167 = -4;
uint32_t t112 = 2U;
t112 = (x1165/((x1166+x1167)>x1168));
if (t112 != 2U) { NG(); } else { ; }
}
void f113(void) {
int64_t x1173 = 2LL;
int64_t x1174 = -1LL;
int8_t x1175 = INT8_MAX;
volatile int64_t t113 = -8401625972567510LL;
t113 = (x1173/((x1174+x1175)>x1176));
if (t113 != 2LL) { NG(); } else { ; }
}
void f114(void) {
int16_t x1185 = INT16_MIN;
static uint16_t x1186 = UINT16_MAX;
uint8_t x1187 = UINT8_MAX;
volatile uint16_t x1188 = UINT16_MAX;
static volatile int32_t t114 = 330;
t114 = (x1185/((x1186+x1187)>x1188));
if (t114 != -32768) { NG(); } else { ; }
}
void f115(void) {
int16_t x1193 = INT16_MIN;
int8_t x1194 = INT8_MIN;
volatile uint32_t x1195 = 63U;
int64_t x1196 = 61LL;
static volatile int32_t t115 = 20504;
t115 = (x1193/((x1194+x1195)>x1196));
if (t115 != -32768) { NG(); } else { ; }
}
void f116(void) {
static int8_t x1201 = INT8_MIN;
static uint16_t x1202 = 11U;
int16_t x1203 = INT16_MIN;
int16_t x1204 = INT16_MIN;
volatile int32_t t116 = 5646;
t116 = (x1201/((x1202+x1203)>x1204));
if (t116 != -128) { NG(); } else { ; }
}
void f117(void) {
uint8_t x1217 = 0U;
volatile int32_t x1220 = -760338;
int32_t t117 = -91429210;
t117 = (x1217/((x1218+x1219)>x1220));
if (t117 != 0) { NG(); } else { ; }
}
void f118(void) {
volatile int32_t x1225 = -1;
uint32_t x1226 = UINT32_MAX;
uint64_t x1227 = 7757511045074LLU;
int8_t x1228 = INT8_MAX;
static int32_t t118 = 18;
t118 = (x1225/((x1226+x1227)>x1228));
if (t118 != -1) { NG(); } else { ; }
}
void f119(void) {
uint32_t x1229 = UINT32_MAX;
int32_t x1230 = -1;
static uint64_t x1231 = 49124071349305911LLU;
uint8_t x1232 = UINT8_MAX;
t119 = (x1229/((x1230+x1231)>x1232));
if (t119 != UINT32_MAX) { NG(); } else { ; }
}
void f120(void) {
static volatile int16_t x1249 = INT16_MIN;
volatile int64_t x1250 = 3891156482LL;
volatile int64_t x1251 = 4021LL;
static int64_t x1252 = -76289245233920742LL;
int32_t t120 = 204890275;
t120 = (x1249/((x1250+x1251)>x1252));
if (t120 != -32768) { NG(); } else { ; }
}
void f121(void) {
static volatile uint16_t x1258 = 840U;
volatile int16_t x1260 = -2;
volatile int64_t t121 = 145565007265LL;
t121 = (x1257/((x1258+x1259)>x1260));
if (t121 != -64553266813716LL) { NG(); } else { ; }
}
void f122(void) {
uint16_t x1269 = UINT16_MAX;
static volatile int32_t x1270 = 1;
t122 = (x1269/((x1270+x1271)>x1272));
if (t122 != 65535) { NG(); } else { ; }
}
void f123(void) {
volatile int8_t x1277 = INT8_MAX;
uint64_t x1278 = 376515877591635062LLU;
int64_t x1279 = INT64_MAX;
volatile int32_t t123 = 2330;
t123 = (x1277/((x1278+x1279)>x1280));
if (t123 != 127) { NG(); } else { ; }
}
void f124(void) {
volatile int32_t x1281 = 11460;
uint16_t x1282 = 5037U;
int8_t x1283 = INT8_MIN;
static uint16_t x1284 = 6U;
static int32_t t124 = -6919847;
t124 = (x1281/((x1282+x1283)>x1284));
if (t124 != 11460) { NG(); } else { ; }
}
void f125(void) {
int64_t x1285 = -1LL;
int64_t x1286 = INT64_MAX;
uint16_t x1287 = 0U;
uint8_t x1288 = UINT8_MAX;
int64_t t125 = 139410376976383LL;
t125 = (x1285/((x1286+x1287)>x1288));
if (t125 != -1LL) { NG(); } else { ; }
}
void f126(void) {
uint16_t x1303 = 120U;
static uint16_t x1304 = 21U;
uint32_t t126 = UINT32_MAX;
t126 = (x1301/((x1302+x1303)>x1304));
if (t126 != UINT32_MAX) { NG(); } else { ; }
}
void f127(void) {
volatile uint8_t x1329 = 40U;
uint8_t x1330 = 9U;
static uint8_t x1331 = UINT8_MAX;
static int16_t x1332 = INT16_MIN;
int32_t t127 = -539246;
t127 = (x1329/((x1330+x1331)>x1332));
if (t127 != 40) { NG(); } else { ; }
}
void f128(void) {
uint16_t x1341 = 5U;
static int64_t x1342 = 127746LL;
uint8_t x1343 = 14U;
volatile int32_t t128 = -873;
t128 = (x1341/((x1342+x1343)>x1344));
if (t128 != 5) { NG(); } else { ; }
}
void f129(void) {
static int64_t x1345 = INT64_MAX;
int32_t x1346 = -1;
volatile int16_t x1347 = -1;
static uint32_t x1348 = 8044U;
int64_t t129 = INT64_MAX;
t129 = (x1345/((x1346+x1347)>x1348));
if (t129 != INT64_MAX) { NG(); } else { ; }
}
void f130(void) {
int32_t x1357 = 218632;
int32_t x1358 = -593394287;
int32_t x1359 = INT32_MAX;
static int16_t x1360 = INT16_MAX;
t130 = (x1357/((x1358+x1359)>x1360));
if (t130 != 218632) { NG(); } else { ; }
}
void f131(void) {
uint64_t x1369 = 743816586LLU;
static int64_t x1370 = -1LL;
volatile int8_t x1372 = -1;
uint64_t t131 = 214723721LLU;
t131 = (x1369/((x1370+x1371)>x1372));
if (t131 != 743816586LLU) { NG(); } else { ; }
}
void f132(void) {
int64_t x1385 = INT64_MAX;
int8_t x1386 = 31;
volatile int64_t t132 = INT64_MAX;
t132 = (x1385/((x1386+x1387)>x1388));
if (t132 != INT64_MAX) { NG(); } else { ; }
}
void f133(void) {
int16_t x1397 = -1008;
int8_t x1399 = 42;
volatile int32_t t133 = -6762;
t133 = (x1397/((x1398+x1399)>x1400));
if (t133 != -1008) { NG(); } else { ; }
}
void f134(void) {
int64_t x1409 = -1LL;
volatile uint64_t x1410 = UINT64_MAX;
int64_t x1411 = INT64_MIN;
static int32_t x1412 = 61017008;
t134 = (x1409/((x1410+x1411)>x1412));
if (t134 != -1LL) { NG(); } else { ; }
}
void f135(void) {
static int32_t x1417 = INT32_MAX;
uint64_t x1419 = 347477671715732LLU;
int32_t x1420 = INT32_MAX;
int32_t t135 = INT32_MAX;
t135 = (x1417/((x1418+x1419)>x1420));
if (t135 != INT32_MAX) { NG(); } else { ; }
}
void f136(void) {
int32_t x1421 = INT32_MIN;
static uint32_t x1422 = 3625809U;
int16_t x1423 = INT16_MIN;
uint8_t x1424 = 15U;
t136 = (x1421/((x1422+x1423)>x1424));
if (t136 != INT32_MIN) { NG(); } else { ; }
}
void f137(void) {
static volatile int64_t x1437 = 67734580708LL;
uint32_t x1438 = UINT32_MAX;
uint32_t x1440 = 503U;
int64_t t137 = -21LL;
t137 = (x1437/((x1438+x1439)>x1440));
if (t137 != 67734580708LL) { NG(); } else { ; }
}
void f138(void) {
int16_t x1454 = INT16_MIN;
int16_t x1456 = INT16_MIN;
static int32_t t138 = INT32_MAX;
t138 = (x1453/((x1454+x1455)>x1456));
if (t138 != INT32_MAX) { NG(); } else { ; }
}
void f139(void) {
int32_t x1465 = INT32_MIN;
static int64_t x1466 = INT64_MAX;
int8_t x1468 = -1;
static volatile int32_t t139 = INT32_MIN;
t139 = (x1465/((x1466+x1467)>x1468));
if (t139 != INT32_MIN) { NG(); } else { ; }
}
void f140(void) {
static int64_t x1469 = 47514207357960025LL;
static int64_t x1470 = -2145LL;
int16_t x1471 = INT16_MIN;
t140 = (x1469/((x1470+x1471)>x1472));
if (t140 != 47514207357960025LL) { NG(); } else { ; }
}
void f141(void) {
static int16_t x1477 = INT16_MIN;
static int16_t x1479 = 166;
uint8_t x1480 = UINT8_MAX;
volatile int32_t t141 = 23;
t141 = (x1477/((x1478+x1479)>x1480));
if (t141 != -32768) { NG(); } else { ; }
}
void f142(void) {
volatile int32_t x1498 = -1;
static int64_t x1499 = -1LL;
volatile int32_t x1500 = INT32_MIN;
volatile int32_t t142 = 399192469;
t142 = (x1497/((x1498+x1499)>x1500));
if (t142 != -128) { NG(); } else { ; }
}
void f143(void) {
static int8_t x1505 = -51;
uint16_t x1506 = UINT16_MAX;
volatile uint32_t x1507 = UINT32_MAX;
uint8_t x1508 = 2U;
t143 = (x1505/((x1506+x1507)>x1508));
if (t143 != -51) { NG(); } else { ; }
}
void f144(void) {
int64_t x1509 = INT64_MIN;
uint8_t x1510 = 13U;
int64_t x1511 = INT64_MIN;
static uint64_t x1512 = 2156379127432700167LLU;
int64_t t144 = INT64_MIN;
t144 = (x1509/((x1510+x1511)>x1512));
if (t144 != INT64_MIN) { NG(); } else { ; }
}
void f145(void) {
volatile int64_t x1513 = INT64_MIN;
volatile int64_t x1514 = -1LL;
static volatile uint64_t x1515 = UINT64_MAX;
int16_t x1516 = INT16_MIN;
int64_t t145 = INT64_MIN;
t145 = (x1513/((x1514+x1515)>x1516));
if (t145 != INT64_MIN) { NG(); } else { ; }
}
void f146(void) {
int16_t x1521 = -659;
int32_t x1523 = INT32_MAX;
int8_t x1524 = INT8_MIN;
int32_t t146 = 77475;
t146 = (x1521/((x1522+x1523)>x1524));
if (t146 != -659) { NG(); } else { ; }
}
void f147(void) {
int8_t x1525 = INT8_MIN;
int64_t x1526 = -1LL;
int16_t x1527 = -1;
int32_t x1528 = INT32_MIN;
volatile int32_t t147 = 45349;
t147 = (x1525/((x1526+x1527)>x1528));
if (t147 != -128) { NG(); } else { ; }
}
void f148(void) {
volatile int16_t x1549 = -531;
uint8_t x1550 = UINT8_MAX;
int64_t x1551 = 43340118457LL;
uint16_t x1552 = UINT16_MAX;
t148 = (x1549/((x1550+x1551)>x1552));
if (t148 != -531) { NG(); } else { ; }
}
void f149(void) {
uint64_t x1553 = UINT64_MAX;
uint32_t x1554 = UINT32_MAX;
uint16_t x1555 = 422U;
int64_t x1556 = INT64_MIN;
uint64_t t149 = UINT64_MAX;
t149 = (x1553/((x1554+x1555)>x1556));
if (t149 != UINT64_MAX) { NG(); } else { ; }
}
void f150(void) {
volatile uint64_t x1557 = 136431987937991LLU;
uint8_t x1558 = UINT8_MAX;
volatile uint8_t x1559 = UINT8_MAX;
static volatile uint8_t x1560 = 18U;
volatile uint64_t t150 = 2747048911997602285LLU;
t150 = (x1557/((x1558+x1559)>x1560));
if (t150 != 136431987937991LLU) { NG(); } else { ; }
}
void f151(void) {
volatile int32_t x1566 = -1;
int64_t x1567 = -1LL;
int32_t t151 = 0;
t151 = (x1565/((x1566+x1567)>x1568));
if (t151 != -128) { NG(); } else { ; }
}
void f152(void) {
uint32_t x1569 = UINT32_MAX;
static volatile int16_t x1571 = -1;
volatile uint64_t x1572 = 384LLU;
uint32_t t152 = UINT32_MAX;
t152 = (x1569/((x1570+x1571)>x1572));
if (t152 != UINT32_MAX) { NG(); } else { ; }
}
void f153(void) {
volatile int32_t x1577 = INT32_MIN;
int64_t x1578 = INT64_MAX;
int16_t x1579 = -434;
uint8_t x1580 = 11U;
int32_t t153 = INT32_MIN;
t153 = (x1577/((x1578+x1579)>x1580));
if (t153 != INT32_MIN) { NG(); } else { ; }
}
void f154(void) {
int64_t x1582 = INT64_MAX;
int64_t x1583 = -1LL;
int32_t x1584 = INT32_MIN;
volatile int32_t t154 = 240770156;
t154 = (x1581/((x1582+x1583)>x1584));
if (t154 != -32768) { NG(); } else { ; }
}
void f155(void) {
uint64_t x1586 = 2LLU;
int32_t x1587 = INT32_MIN;
static int32_t x1588 = INT32_MIN;
t155 = (x1585/((x1586+x1587)>x1588));
if (t155 != 6911963625497630LL) { NG(); } else { ; }
}
void f156(void) {
uint8_t x1589 = 0U;
int8_t x1590 = INT8_MAX;
static int32_t x1591 = -1;
volatile int32_t t156 = 2394;
t156 = (x1589/((x1590+x1591)>x1592));
if (t156 != 0) { NG(); } else { ; }
}
void f157(void) {
int8_t x1609 = -1;
uint32_t x1610 = UINT32_MAX;
int64_t x1612 = 9165102LL;
int32_t t157 = -601;
t157 = (x1609/((x1610+x1611)>x1612));
if (t157 != -1) { NG(); } else { ; }
}
void f158(void) {
volatile int8_t x1617 = INT8_MIN;
int32_t t158 = -37360510;
t158 = (x1617/((x1618+x1619)>x1620));
if (t158 != -128) { NG(); } else { ; }
}
void f159(void) {
volatile int64_t x1629 = 716258257141LL;
volatile int64_t x1630 = 355739467LL;
int8_t x1632 = INT8_MAX;
volatile int64_t t159 = 90LL;
t159 = (x1629/((x1630+x1631)>x1632));
if (t159 != 716258257141LL) { NG(); } else { ; }
}
void f160(void) {
static uint64_t x1633 = 1015166947743678498LLU;
static int16_t x1636 = INT16_MIN;
t160 = (x1633/((x1634+x1635)>x1636));
if (t160 != 1015166947743678498LLU) { NG(); } else { ; }
}
void f161(void) {
int8_t x1637 = INT8_MIN;
static uint32_t x1638 = UINT32_MAX;
int32_t x1639 = INT32_MAX;
uint8_t x1640 = 126U;
t161 = (x1637/((x1638+x1639)>x1640));
if (t161 != -128) { NG(); } else { ; }
}
void f162(void) {
volatile int16_t x1657 = INT16_MAX;
int8_t x1658 = -1;
int8_t x1660 = INT8_MIN;
t162 = (x1657/((x1658+x1659)>x1660));
if (t162 != 32767) { NG(); } else { ; }
}
void f163(void) {
static volatile int16_t x1661 = -1;
static int64_t x1662 = -5345365638606LL;
uint32_t x1663 = UINT32_MAX;
int32_t t163 = 27;
t163 = (x1661/((x1662+x1663)>x1664));
if (t163 != -1) { NG(); } else { ; }
}
void f164(void) {
uint32_t x1673 = UINT32_MAX;
int8_t x1674 = -1;
uint32_t x1675 = UINT32_MAX;
volatile uint32_t t164 = UINT32_MAX;
t164 = (x1673/((x1674+x1675)>x1676));
if (t164 != UINT32_MAX) { NG(); } else { ; }
}
void f165(void) {
static int64_t x1677 = INT64_MAX;
int8_t x1678 = INT8_MAX;
uint16_t x1679 = 219U;
int32_t x1680 = -1879;
volatile int64_t t165 = INT64_MAX;
t165 = (x1677/((x1678+x1679)>x1680));
if (t165 != INT64_MAX) { NG(); } else { ; }
}
void f166(void) {
static uint16_t x1689 = UINT16_MAX;
int16_t x1691 = INT16_MAX;
int8_t x1692 = INT8_MIN;
int32_t t166 = 227;
t166 = (x1689/((x1690+x1691)>x1692));
if (t166 != 65535) { NG(); } else { ; }
}
void f167(void) {
int8_t x1693 = INT8_MAX;
int32_t x1695 = 7499703;
static int32_t x1696 = INT32_MIN;
t167 = (x1693/((x1694+x1695)>x1696));
if (t167 != 127) { NG(); } else { ; }
}
void f168(void) {
static int8_t x1697 = -10;
static uint8_t x1698 = UINT8_MAX;
int32_t t168 = 1576838;
t168 = (x1697/((x1698+x1699)>x1700));
if (t168 != -10) { NG(); } else { ; }
}
void f169(void) {
uint8_t x1705 = 117U;
int32_t x1706 = -1;
volatile int16_t x1707 = -1;
volatile int32_t t169 = -129253;
t169 = (x1705/((x1706+x1707)>x1708));
if (t169 != 117) { NG(); } else { ; }
}
void f170(void) {
static volatile uint8_t x1709 = UINT8_MAX;
uint64_t x1710 = UINT64_MAX;
uint16_t x1712 = UINT16_MAX;
volatile int32_t t170 = 829333619;
t170 = (x1709/((x1710+x1711)>x1712));
if (t170 != 255) { NG(); } else { ; }
}
void f171(void) {
uint8_t x1713 = 6U;
static int16_t x1714 = -3;
int64_t x1715 = 1731986009065702322LL;
static uint8_t x1716 = UINT8_MAX;
volatile int32_t t171 = -57;
t171 = (x1713/((x1714+x1715)>x1716));
if (t171 != 6) { NG(); } else { ; }
}
void f172(void) {
volatile uint64_t x1717 = UINT64_MAX;
int16_t x1718 = 3;
int8_t x1719 = -1;
int16_t x1720 = -1;
volatile uint64_t t172 = UINT64_MAX;
t172 = (x1717/((x1718+x1719)>x1720));
if (t172 != UINT64_MAX) { NG(); } else { ; }
}
void f173(void) {
int8_t x1721 = INT8_MIN;
int8_t x1722 = INT8_MIN;
static int32_t x1723 = -1;
static uint64_t x1724 = 2210076088923181185LLU;
volatile int32_t t173 = 178842;
t173 = (x1721/((x1722+x1723)>x1724));
if (t173 != -128) { NG(); } else { ; }
}
void f174(void) {
static int64_t x1757 = -3302908077526677348LL;
volatile uint8_t x1758 = 13U;
int16_t x1760 = 1;
static volatile int64_t t174 = -29582899868LL;
t174 = (x1757/((x1758+x1759)>x1760));
if (t174 != -3302908077526677348LL) { NG(); } else { ; }
}
void f175(void) {
static int8_t x1761 = INT8_MIN;
uint32_t x1762 = 50687U;
int32_t x1763 = INT32_MIN;
static volatile uint16_t x1764 = 24U;
static volatile int32_t t175 = 1;
t175 = (x1761/((x1762+x1763)>x1764));
if (t175 != -128) { NG(); } else { ; }
}
void f176(void) {
volatile uint16_t x1778 = 0U;
static int32_t x1779 = INT32_MAX;
static volatile int8_t x1780 = -1;
int32_t t176 = 6435482;
t176 = (x1777/((x1778+x1779)>x1780));
if (t176 != 1) { NG(); } else { ; }
}
void f177(void) {
int8_t x1789 = -1;
static int8_t x1790 = -1;
int32_t t177 = -128850443;
t177 = (x1789/((x1790+x1791)>x1792));
if (t177 != -1) { NG(); } else { ; }
}
void f178(void) {
int32_t x1801 = -1;
uint64_t x1802 = 524215289674640477LLU;
volatile int8_t x1803 = INT8_MIN;
static uint8_t x1804 = 13U;
volatile int32_t t178 = 346597;
t178 = (x1801/((x1802+x1803)>x1804));
if (t178 != -1) { NG(); } else { ; }
}
void f179(void) {
uint64_t x1805 = 17492910LLU;
int8_t x1806 = INT8_MAX;
volatile uint16_t x1807 = 148U;
volatile uint64_t t179 = 11303895LLU;
t179 = (x1805/((x1806+x1807)>x1808));
if (t179 != 17492910LLU) { NG(); } else { ; }
}
void f180(void) {
uint64_t x1809 = UINT64_MAX;
volatile int8_t x1810 = -9;
uint64_t x1811 = UINT64_MAX;
uint16_t x1812 = 3048U;
uint64_t t180 = UINT64_MAX;
t180 = (x1809/((x1810+x1811)>x1812));
if (t180 != UINT64_MAX) { NG(); } else { ; }
}
void f181(void) {
uint32_t x1813 = 141U;
volatile int64_t x1814 = -1LL;
int8_t x1816 = INT8_MAX;
volatile uint32_t t181 = 277U;
t181 = (x1813/((x1814+x1815)>x1816));
if (t181 != 141U) { NG(); } else { ; }
}
void f182(void) {
int32_t x1817 = 119;
int16_t x1818 = INT16_MAX;
volatile int8_t x1819 = -6;
int8_t x1820 = 0;
t182 = (x1817/((x1818+x1819)>x1820));
if (t182 != 119) { NG(); } else { ; }
}
void f183(void) {
int64_t x1825 = -1LL;
uint8_t x1826 = UINT8_MAX;
int8_t x1828 = 0;
int64_t t183 = -1LL;
t183 = (x1825/((x1826+x1827)>x1828));
if (t183 != -1LL) { NG(); } else { ; }
}
void f184(void) {
uint16_t x1833 = 6583U;
int8_t x1834 = 2;
static uint64_t x1836 = 0LLU;
int32_t t184 = 122;
t184 = (x1833/((x1834+x1835)>x1836));
if (t184 != 6583) { NG(); } else { ; }
}
void f185(void) {
static int64_t x1837 = INT64_MIN;
int8_t x1838 = INT8_MAX;
int16_t x1839 = -3751;
uint64_t x1840 = 398299714LLU;
volatile int64_t t185 = INT64_MIN;
t185 = (x1837/((x1838+x1839)>x1840));
if (t185 != INT64_MIN) { NG(); } else { ; }
}
void f186(void) {
static int32_t x1849 = INT32_MIN;
t186 = (x1849/((x1850+x1851)>x1852));
if (t186 != INT32_MIN) { NG(); } else { ; }
}
void f187(void) {
uint32_t x1853 = UINT32_MAX;
uint32_t x1854 = 11279U;
static uint64_t x1855 = 21014418393968LLU;
int32_t x1856 = INT32_MAX;
static volatile uint32_t t187 = UINT32_MAX;
t187 = (x1853/((x1854+x1855)>x1856));
if (t187 != UINT32_MAX) { NG(); } else { ; }
}
void f188(void) {
int16_t x1865 = INT16_MAX;
int8_t x1866 = INT8_MIN;
static int16_t x1868 = INT16_MIN;
volatile int32_t t188 = 9;
t188 = (x1865/((x1866+x1867)>x1868));
if (t188 != 32767) { NG(); } else { ; }
}
void f189(void) {
int64_t x1877 = INT64_MIN;
uint16_t x1878 = 7150U;
int64_t x1879 = 282909825231LL;
static int64_t x1880 = -1LL;
t189 = (x1877/((x1878+x1879)>x1880));
if (t189 != INT64_MIN) { NG(); } else { ; }
}
void f190(void) {
int16_t x1881 = INT16_MIN;
uint64_t x1882 = 1246263752027488989LLU;
uint16_t x1883 = 133U;
volatile uint32_t x1884 = UINT32_MAX;
int32_t t190 = 550941;
t190 = (x1881/((x1882+x1883)>x1884));
if (t190 != -32768) { NG(); } else { ; }
}
void f191(void) {
static int16_t x1889 = 295;
int64_t x1890 = -1LL;
volatile int32_t x1891 = 21944;
uint64_t x1892 = 1718LLU;
volatile int32_t t191 = 62;
t191 = (x1889/((x1890+x1891)>x1892));
if (t191 != 295) { NG(); } else { ; }
}
void f192(void) {
int64_t x1913 = INT64_MIN;
int8_t x1915 = 5;
volatile uint8_t x1916 = 3U;
t192 = (x1913/((x1914+x1915)>x1916));
if (t192 != INT64_MIN) { NG(); } else { ; }
}
void f193(void) {
volatile uint8_t x1917 = 1U;
volatile uint64_t x1918 = UINT64_MAX;
static int8_t x1919 = -1;
volatile int32_t x1920 = -11136044;
volatile int32_t t193 = 330;
t193 = (x1917/((x1918+x1919)>x1920));
if (t193 != 1) { NG(); } else { ; }
}
void f194(void) {
uint64_t x1921 = 1010359825701128LLU;
int8_t x1922 = INT8_MIN;
static int8_t x1923 = 0;
static int16_t x1924 = INT16_MIN;
volatile uint64_t t194 = 119942804155176961LLU;
t194 = (x1921/((x1922+x1923)>x1924));
if (t194 != 1010359825701128LLU) { NG(); } else { ; }
}
void f195(void) {
static volatile uint16_t x1926 = UINT16_MAX;
int8_t x1928 = 29;
t195 = (x1925/((x1926+x1927)>x1928));
if (t195 != 313463U) { NG(); } else { ; }
}
void f196(void) {
int8_t x1937 = INT8_MIN;
int8_t x1938 = -1;
int8_t x1939 = -1;
volatile uint32_t x1940 = 408607891U;
t196 = (x1937/((x1938+x1939)>x1940));
if (t196 != -128) { NG(); } else { ; }
}
void f197(void) {
volatile int64_t x1941 = INT64_MAX;
volatile int32_t x1944 = -1;
t197 = (x1941/((x1942+x1943)>x1944));
if (t197 != INT64_MAX) { NG(); } else { ; }
}
void f198(void) {
uint32_t x1945 = 2U;
int16_t x1946 = -1;
uint64_t x1947 = 1599446929838676120LLU;
static uint32_t x1948 = 1U;
uint32_t t198 = 38U;
t198 = (x1945/((x1946+x1947)>x1948));
if (t198 != 2U) { NG(); } else { ; }
}
void f199(void) {
int8_t x1957 = -1;
int16_t x1958 = INT16_MAX;
int16_t x1959 = INT16_MAX;
uint8_t x1960 = 2U;
volatile int32_t t199 = 1300428;
t199 = (x1957/((x1958+x1959)>x1960));
if (t199 != -1) { NG(); } else { ; }
}
int main(void) {
f0();
f1();
f2();
f3();
f4();
f5();
f6();
f7();
f8();
f9();
f10();
f11();
f12();
f13();
f14();
f15();
f16();
f17();
f18();
f19();
f20();
f21();
f22();
f23();
f24();
f25();
f26();
f27();
f28();
f29();
f30();
f31();
f32();
f33();
f34();
f35();
f36();
f37();
f38();
f39();
f40();
f41();
f42();
f43();
f44();
f45();
f46();
f47();
f48();
f49();
f50();
f51();
f52();
f53();
f54();
f55();
f56();
f57();
f58();
f59();
f60();
f61();
f62();
f63();
f64();
f65();
f66();
f67();
f68();
f69();
f70();
f71();
f72();
f73();
f74();
f75();
f76();
f77();
f78();
f79();
f80();
f81();
f82();
f83();
f84();
f85();
f86();
f87();
f88();
f89();
f90();
f91();
f92();
f93();
f94();
f95();
f96();
f97();
f98();
f99();
f100();
f101();
f102();
f103();
f104();
f105();
f106();
f107();
f108();
f109();
f110();
f111();
f112();
f113();
f114();
f115();
f116();
f117();
f118();
f119();
f120();
f121();
f122();
f123();
f124();
f125();
f126();
f127();
f128();
f129();
f130();
f131();
f132();
f133();
f134();
f135();
f136();
f137();
f138();
f139();
f140();
f141();
f142();
f143();
f144();
f145();
f146();
f147();
f148();
f149();
f150();
f151();
f152();
f153();
f154();
f155();
f156();
f157();
f158();
f159();
f160();
f161();
f162();
f163();
f164();
f165();
f166();
f167();
f168();
f169();
f170();
f171();
f172();
f173();
f174();
f175();
f176();
f177();
f178();
f179();
f180();
f181();
f182();
f183();
f184();
f185();
f186();
f187();
f188();
f189();
f190();
f191();
f192();
f193();
f194();
f195();
f196();
f197();
f198();
f199();
return 0;
}
| 19.215297 | 60 | 0.600951 |
3d38d7c7f43fc6f85f5759750b13a99e6b613291
| 515 |
rs
|
Rust
|
tests/wasm_tests.rs
|
sarahmeyer/exspork
|
68b1ad1c091b5cf3c0e41c323428683f8e02515e
|
[
"Apache-2.0",
"MIT"
] | 5 |
2018-06-11T10:42:26.000Z
|
2018-09-08T00:54:04.000Z
|
tests/wasm_tests.rs
|
sarahmeyer/exspork
|
68b1ad1c091b5cf3c0e41c323428683f8e02515e
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
tests/wasm_tests.rs
|
sarahmeyer/exspork
|
68b1ad1c091b5cf3c0e41c323428683f8e02515e
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
extern crate exspork;
use exspork::read_cargo_toml;
#[test]
fn test_cargo_read() {
let config = read_cargo_toml("Cargo.toml").unwrap();
assert_eq!(config.package.name, "exspork".to_string());
assert_eq!(config.package.version, "0.1.0".to_string());
assert_eq!(config.package.license, Some("MIT/Apache-2.0".to_string()));
assert_eq!(config.package.description, Some("Generates documentation for your \
wasm project by parsing the export statements in your typescript".to_string()));
}
| 34.333333 | 88 | 0.716505 |
124a31a43722e39a9dd4db3fd8c5cdbfd3b41b42
| 592 |
h
|
C
|
iOSFactory/iOSFactory/MSDCVCVMV/APEUserSubject.h
|
zhangjk4859/iOSFactory
|
b6c15ede51778d340b085b22ba15642492d1d63e
|
[
"MIT"
] | 1 |
2019-09-19T03:20:03.000Z
|
2019-09-19T03:20:03.000Z
|
iOSFactory/iOSFactory/MSDCVCVMV/APEUserSubject.h
|
zhangjk4859/iOSFactory
|
b6c15ede51778d340b085b22ba15642492d1d63e
|
[
"MIT"
] | null | null | null |
iOSFactory/iOSFactory/MSDCVCVMV/APEUserSubject.h
|
zhangjk4859/iOSFactory
|
b6c15ede51778d340b085b22ba15642492d1d63e
|
[
"MIT"
] | null | null | null |
//
// APEUserSubject.h
// iOSFactory
//
// Created by kevin on 2019/5/13.
// Copyright © 2019 jumu. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface APESubject : NSObject
@property (nonatomic, strong, nullable) NSNumber *id;
@property (nonatomic, strong, nullable) NSString *name;
@end
@interface APEUserSubject : NSObject
@property (nonatomic, strong, nullable) NSNumber *id;
@property (nonatomic, strong, nullable) NSNumber *updatedTime;
/// On or Off
//@property (nonatomic) APEUserSubjectStatus status;
@end
NS_ASSUME_NONNULL_END
| 19.733333 | 62 | 0.746622 |
b6da0bb4ae81472c509218aeb58ecfda6e71bc87
| 2,940 |
lua
|
Lua
|
init.lua
|
vincens2005/lite-xl-discord
|
438d7231e95b29a46abf7d13aca3c6261d425bef
|
[
"MIT"
] | 2 |
2021-06-11T20:24:31.000Z
|
2021-09-02T14:54:40.000Z
|
init.lua
|
vincens2005/lite-xl-discord
|
438d7231e95b29a46abf7d13aca3c6261d425bef
|
[
"MIT"
] | 4 |
2021-06-03T02:18:14.000Z
|
2021-12-15T00:39:27.000Z
|
init.lua
|
vincens2005/lite-xl-discord
|
438d7231e95b29a46abf7d13aca3c6261d425bef
|
[
"MIT"
] | 2 |
2021-07-31T02:47:45.000Z
|
2021-08-29T16:13:37.000Z
|
-- mod-version:1 lite-xl 2.00
local core = require "core"
local command = require "core.command"
local common = require "core.common"
local config = require "core.config"
-- function replacements:
local quit = core.quit
local restart = core.restart
local status = {filename = nil, space = nil}
-- stolen from https://stackoverflow.com/questions/1426954/split-string-in-lua
local function split_string(inputstr, sep)
if sep == nil then sep = "%s" end
local t = {}
for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
table.insert(t, str)
end
return t
end
local function tell_discord_to_stop()
local cmd = "python3 " .. USERDIR ..
"/plugins/lite-xl-discord/update_presence.py --state='no' --details='no' --die-now='yes' --pickle=" ..
USERDIR .. "/plugins/lite-xl-discord/discord_data.pickle"
-- core.log("running command ".. command)
core.log("stopping discord rpc...")
system.exec(cmd)
end
local function update_status()
local filename = "unsaved file"
-- return if doc isn't active
if not core.active_view then return end
if not core.active_view.doc then return end
if core.active_view.doc.filename then
filename = core.active_view.doc.filename
filename = split_string(filename, "/")
filename = filename[#filename]
end
local details = "editing " .. filename
local dir = common.basename(core.project_dir)
local state = "in " .. dir
status.filename = filename
status.space = dir
local cmd = "python3 " .. USERDIR ..
"/plugins/lite-xl-discord/update_presence.py --state='" ..
state .. "' --details='" .. details ..
"' --die-now='no' --pickle=" .. USERDIR ..
"/plugins/lite-xl-discord/discord_data.pickle"
system.exec(cmd)
end
local function start_rpc()
core.log("discord plugin: starting python script")
system.exec("python3 " .. USERDIR ..
"/plugins/lite-xl-discord/presence.py --pickle=" .. USERDIR ..
"/plugins/lite-xl-discord/discord_data.pickle --pidfile=" .. USERDIR .. "/plugins/lite-xl-discord/pidfile.pid")
update_status()
end
core.quit = function(force)
tell_discord_to_stop()
return quit(force)
end
core.restart = function()
tell_discord_to_stop()
return restart()
end
core.add_thread(function()
while true do
-- skip loop if doc isn't active
if not core.active_view then goto continue end
if not core.active_view.doc then goto continue end
if not (common.basename(core.project_dir) == status.space and
core.active_view.doc.filename == status.filename) then
update_status()
end
::continue::
coroutine.yield(config.project_scan_rate)
end
end)
command.add("core.docview",
{["discord-presence:stop-RPC"] = tell_discord_to_stop})
command.add("core.docview", {["discord-presence:update-RPC"] = update_status})
command.add("core.docview", {["discord-presence:start-RPC"] = start_rpc})
start_rpc()
| 30.625 | 127 | 0.677551 |
5b12f78c1fb989b7ff9ac903bf51112ef337e8e0
| 2,881 |
h
|
C
|
esp8266/include/esp8266.h
|
Kurt-E-Clothier/Javamon
|
3446bdcba067506f7462e5d32bb0f1d8b3fd0790
|
[
"MIT"
] | 9 |
2015-07-01T21:57:12.000Z
|
2017-03-18T21:48:43.000Z
|
esp8266/include/esp8266.h
|
Kurt-E-Clothier/Javamon
|
3446bdcba067506f7462e5d32bb0f1d8b3fd0790
|
[
"MIT"
] | 1 |
2021-02-24T02:43:15.000Z
|
2021-02-24T02:43:15.000Z
|
esp8266/include/esp8266.h
|
Kurt-E-Clothier/Javamon
|
3446bdcba067506f7462e5d32bb0f1d8b3fd0790
|
[
"MIT"
] | 8 |
2016-01-04T15:39:12.000Z
|
2021-01-13T11:25:31.000Z
|
/***************************************************************************
*
* File : esp8266.h
*
* Author : Kurt E. Clothier
* Date : June 1, 2015
* Modified : June 23, 2015
*
* Description : Header File for all Projects
*
* Compiler : Xtensa Tools - GCC
* Hardware : ESP8266-x
*
* More Information : http://www.projectsbykec.com/
* : http://www.pubnub.com/
* : http://www.esp8266.com/
*
****************************************************************************/
/**************************************************************************
Definitions
***************************************************************************/
#define user_procTaskPrio 0
#define user_procTaskQueueLen 1
#define IFA ICACHE_FLASH_ATTR
#define REPEAT 1
#define NO_REPEAT 0
/**************************************************************************
Included Header Files
***************************************************************************/
#include "ets_sys.h"
#include "osapi.h"
#include "gpio.h"
#include "os_type.h"
#include "user_config.h"
#include "user_interface.h"
#include "c_types.h"
#include "espconn.h"
#include "mem.h"
/**************************************************************************
GPIO Handling
***************************************************************************/
// Until I better understand the register mapping for GPIO pins,
// we'll have to rely on functions/macros from the SDK for this.
#define PIN_IS_HI(P) (GPIO_INPUT_GET(GPIO_ID_PIN(P)))
#define PIN_IS_LO(P) !PIN_IS_HI(P)
#define SET_PIN_HI(P) gpio_output_set(BIT ## P, 0, BIT ## P, 0)
#define SET_PIN_LO(P) gpio_output_set(0, BIT ## P, BIT ## P, 0)
#define SET_AS_INPUT(P) gpio_output_set(0, 0, 0, BIT ## P)
/**************************************************************************
Common Function Mapping
***************************************************************************/
#ifndef printf
#define printf os_printf
#endif
#ifndef sprintf
#define sprintf os_sprintf
#endif
#ifndef memcpy
#define memcpy os_memcpy
#endif
#ifndef strlen
#define strlen os_strlen
#endif
// Because... bad English...
#ifndef espconn_send
#define espconn_send espconn_sent
#endif
// SDK Backwards Compatibility
#ifndef os_timer_done
#define os_timer_done ets_timer_done
#endif
#ifndef os_timer_handler
#define os_timer_handler ets_timer_handler_isr
#endif
#ifndef os_timer_init
#define os_timer_init ets_timer_init
#endif
#ifndef os_update_cpu_frequency
#define os_update_cpu_frequency ets_update_cpu_frequency
#endif
/**************************************************************************
Other Helpful Macros
***************************************************************************/
// Only prints lines for debugging purposes
#ifdef DEBUG_PRINT_
# define DEBUG_PRINT(S) printf S
#else
# define DEBUG_PRINT
#endif
| 26.431193 | 77 | 0.502256 |
a88f1e0c89a49ad71799b423e9d10ea70e8dbc11
| 5,421 |
rs
|
Rust
|
src/util/bitpacker.rs
|
MarcoPolo/rust-sssmc39
|
a3e9d53d295b249c0212d6f7ab9dc434c8210df2
|
[
"Apache-2.0"
] | 19 |
2019-05-08T16:15:42.000Z
|
2021-05-13T12:52:19.000Z
|
src/util/bitpacker.rs
|
MarcoPolo/rust-sssmc39
|
a3e9d53d295b249c0212d6f7ab9dc434c8210df2
|
[
"Apache-2.0"
] | 4 |
2019-09-26T08:01:28.000Z
|
2020-01-29T16:01:25.000Z
|
src/util/bitpacker.rs
|
MarcoPolo/rust-sssmc39
|
a3e9d53d295b249c0212d6f7ab9dc434c8210df2
|
[
"Apache-2.0"
] | 4 |
2019-09-19T14:56:02.000Z
|
2021-12-23T20:34:27.000Z
|
// Copyright 2019 The Grin Developers
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! Operations that allow packing bits from primitives into a bitvec
//! Slower, but easier to follow and modify than a lot of bit twiddling
//! BigEndian, as is bitvec default
use bitvec::prelude::*;
use crate::error::{Error, ErrorKind};
/// Simple struct that wraps a bitvec and defines packing operations on it
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BitPacker {
bv: BitVec,
}
//TODO:
// * Works, but:
// * Faster
// * Generics
// * Iterator for reading values
//
impl BitPacker {
/// Create a new bitpacker
pub fn new() -> Self {
BitPacker { bv: BitVec::new() }
}
/// Remove bits from end to meet boundary (for reading in u8 arrays)
pub fn normalize(&mut self, radix: usize) {
while self.bv.len() % radix != 0 {
self.bv.pop();
}
}
/// Append num_bits of zero padding to the internal bitvec
pub fn append_padding(&mut self, num_bits: u8) {
for _ in 0..num_bits {
self.bv.push(false);
}
}
/// Append each element of a u8 vec to the bitvec
pub fn append_vec_u8(&mut self, data: &[u8]) -> Result<(), Error> {
for b in data {
self.append_u8(*b, 8)?;
}
Ok(())
}
/// Return n u8s from bitvec
pub fn get_vec_u8(&mut self, start_pos: usize, len: usize) -> Result<Vec<u8>, Error> {
let mut retvec = vec![];
for i in (start_pos..len * 8).step_by(8) {
retvec.push(self.get_u8(i, 8)?);
}
Ok(retvec)
}
/// Append first num_bits of a u32 to the bitvec. num_bits must be <= 32
pub fn append_u32(&mut self, val: u32, num_bits: u8) -> Result<(), Error> {
if num_bits > 32 {
return Err(ErrorKind::BitVec("number of bits to pack must be <= 32".to_string()))?;
}
for i in (0u8..num_bits).rev() {
if val & 2u32.pow(u32::from(i)) == 0 {
self.bv.push(false);
} else {
self.bv.push(true);
}
}
Ok(())
}
/// Append first num_bits of a u16 to the bitvec. num_bits must be <= 16
pub fn append_u16(&mut self, val: u16, num_bits: u8) -> Result<(), Error> {
if num_bits > 16 {
return Err(ErrorKind::BitVec("number of bits to pack must be <= 16".to_string()))?;
}
for i in (0u8..num_bits).rev() {
if val & 2u16.pow(u32::from(i)) == 0 {
self.bv.push(false);
} else {
self.bv.push(true);
}
}
Ok(())
}
/// Append first num_bits of a u8 to the bitvec, num_bits must be <= 8
pub fn append_u8(&mut self, val: u8, num_bits: u8) -> Result<(), Error> {
if num_bits > 8 {
return Err(ErrorKind::BitVec("number of bits to pack must be <= 8".to_string()))?;
}
for i in (0u8..num_bits).rev() {
if val & 2u8.pow(u32::from(i)) == 0 {
self.bv.push(false);
} else {
self.bv.push(true);
}
}
Ok(())
}
/// Retrieve num_bits from the given index as a u8
pub fn get_u8(&self, index: usize, num_bits: usize) -> Result<u8, Error> {
let mut retval: u8 = 0;
for i in index..index + num_bits {
if i < self.bv.len() && self.bv[i] {
retval += 1;
}
if i < index + num_bits - 1 {
retval <<= 1;
}
}
Ok(retval)
}
/// Retrieve num_bits from the given index as a u16
pub fn get_u16(&self, index: usize, num_bits: usize) -> Result<u16, Error> {
let mut retval: u16 = 0;
for i in index..index + num_bits {
if i < self.bv.len() && self.bv[i] {
retval += 1;
}
if i < index + num_bits - 1 {
retval <<= 1;
}
}
Ok(retval)
}
/// Retrieve num_bits from the given index as a u32
pub fn get_u32(&self, index: usize, num_bits: usize) -> Result<u32, Error> {
let mut retval: u32 = 0;
for i in index..index + num_bits {
if i < self.bv.len() && self.bv[i] {
retval += 1;
}
if i < index + num_bits - 1 {
retval <<= 1;
}
}
Ok(retval)
}
/// Return length of internal bit vector
pub fn len(&self) -> usize {
self.bv.len()
}
/// Return bitvec between m and n
pub fn split_out(&mut self, m: usize, n: usize) {
self.bv.split_off(n);
self.bv = self.bv.split_off(m);
}
/// Return bitvec between m and n
pub fn remove_padding(&mut self, num_bits: usize) -> Result<(), Error> {
let mut removed = self.bv.clone();
self.bv = removed.split_off(num_bits);
if removed.count_ones() > 0 {
return Err(ErrorKind::Padding)?;
}
Ok(())
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::error::Error;
#[test]
fn bit_packer() -> Result<(), Error> {
let mut bp = BitPacker::new();
let val1: u16 = 32534;
let val2: u8 = 12;
let val3: u8 = 15;
let val4: u8 = 8;
let val5: u16 = 934;
bp.append_u16(val1, 15)?;
bp.append_u8(val2, 5)?;
bp.append_u8(val3, 4)?;
bp.append_u8(val4, 4)?;
bp.append_u16(val5, 10)?;
assert_eq!(bp.len(), 38);
assert_eq!(val1, bp.get_u16(0, 15)?);
assert_eq!(val2, bp.get_u8(15, 5)?);
assert_eq!(val3, bp.get_u8(20, 4)?);
assert_eq!(val4, bp.get_u8(24, 4)?);
assert_eq!(val5, bp.get_u16(28, 10)?);
assert_eq!(u32::from(val5), bp.get_u32(28, 10)?);
Ok(())
}
}
| 25.691943 | 87 | 0.620919 |
f01546244daef76f91454218d243e57cff9b2fef
| 113 |
py
|
Python
|
feast/DetectionModules/__init__.py
|
ChandlerKemp/FEAST_PtE
|
9551824932379149dd6bc9135cfac6edf60c40c8
|
[
"MIT"
] | 3 |
2020-04-21T18:59:01.000Z
|
2021-01-14T22:56:17.000Z
|
feast/DetectionModules/__init__.py
|
ChandlerKemp/FEAST_PtE
|
9551824932379149dd6bc9135cfac6edf60c40c8
|
[
"MIT"
] | null | null | null |
feast/DetectionModules/__init__.py
|
ChandlerKemp/FEAST_PtE
|
9551824932379149dd6bc9135cfac6edf60c40c8
|
[
"MIT"
] | null | null | null |
from . import null
from . import abstract_detection_method
from . import tech_detect
from . import tiered_detect
| 22.6 | 39 | 0.823009 |
1b1348dfc1f99c6164d813609c58f4dcc5ffd165
| 153 |
lua
|
Lua
|
config.lua
|
AmirkhajehB/antilink_amir2030bot
|
c6b638352c4a8ec1557170c1b22a9e94cc425c21
|
[
"MIT"
] | null | null | null |
config.lua
|
AmirkhajehB/antilink_amir2030bot
|
c6b638352c4a8ec1557170c1b22a9e94cc425c21
|
[
"MIT"
] | null | null | null |
config.lua
|
AmirkhajehB/antilink_amir2030bot
|
c6b638352c4a8ec1557170c1b22a9e94cc425c21
|
[
"MIT"
] | null | null | null |
bot_token = "278369956:AAErVhLw6LeNPZEP31XMNIC4-KjFf_lbCJI"
send_api = "https://api.telegram.org/bot"..bot_token
bot_version = "1.1"
sudo_id = 216507730
| 30.6 | 59 | 0.784314 |
43d1fe48637bcc7f15df95e84a25ca9165089b7c
| 4,720 |
go
|
Go
|
services/lake/relay/relay.go
|
jancajthaml-openbank/lake
|
a24a0688e1b44854c720b09059982a626dbeb7aa
|
[
"Apache-2.0"
] | 2 |
2018-07-25T22:12:12.000Z
|
2019-07-22T08:56:05.000Z
|
services/lake/relay/relay.go
|
jancajthaml-openbank/lake
|
a24a0688e1b44854c720b09059982a626dbeb7aa
|
[
"Apache-2.0"
] | 42 |
2018-01-22T09:37:25.000Z
|
2022-03-21T09:56:57.000Z
|
services/lake/relay/relay.go
|
jancajthaml-openbank/lake
|
a24a0688e1b44854c720b09059982a626dbeb7aa
|
[
"Apache-2.0"
] | 2 |
2020-05-23T21:36:26.000Z
|
2020-09-16T05:04:36.000Z
|
// Copyright (c) 2016-2021, Jan Cajthaml <jan.cajthaml@gmail.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package relay
import (
"fmt"
"github.com/jancajthaml-openbank/lake/metrics"
"github.com/pebbe/zmq4"
)
// Relay 1:N (PULL -> PUB)
type Relay struct {
pullPort string
pubPort string
metrics metrics.Metrics
puller *zmq4.Socket
pusher *zmq4.Socket
publisher *zmq4.Socket
ctx *zmq4.Context
done chan interface{}
}
// NewRelay returns new instance of Relay
func NewRelay(pull int, pub int, metrics metrics.Metrics) *Relay {
return &Relay{
pullPort: fmt.Sprintf("tcp://127.0.0.1:%d", pull),
pubPort: fmt.Sprintf("tcp://127.0.0.1:%d", pub),
metrics: metrics,
done: nil,
}
}
func (relay *Relay) setupContext() (err error) {
if relay == nil || relay.ctx != nil {
return
}
relay.ctx, err = zmq4.NewContext()
if err != nil {
return
}
relay.ctx.SetRetryAfterEINTR(false)
return
}
func (relay *Relay) setupPuller() (err error) {
if relay == nil || relay.puller != nil {
return
}
relay.puller, err = relay.ctx.NewSocket(zmq4.PULL)
if err != nil {
return
}
relay.puller.SetLinger(0)
relay.puller.SetConflate(false)
relay.puller.SetImmediate(true)
relay.puller.SetRcvhwm(0)
for relay.puller.Bind(relay.pullPort) != nil {
}
return
}
func (relay *Relay) setupPublisher() (err error) {
if relay == nil || relay.publisher != nil {
return
}
relay.publisher, err = relay.ctx.NewSocket(zmq4.PUB)
if err != nil {
return
}
relay.publisher.SetLinger(0)
relay.publisher.SetConflate(false)
relay.publisher.SetImmediate(true)
relay.publisher.SetSndhwm(0)
relay.publisher.SetXpubNodrop(true)
for relay.publisher.Bind(relay.pubPort) != nil {
}
return
}
func (relay *Relay) setupPusher() (err error) {
if relay == nil || relay.pusher != nil {
return
}
relay.pusher, err = relay.ctx.NewSocket(zmq4.PUSH)
if err != nil {
return
}
relay.pusher.SetLinger(0)
relay.pusher.SetConflate(true)
relay.pusher.SetImmediate(true)
for relay.pusher.Connect(relay.pullPort) != nil {
}
return
}
// Setup initializes zmq context and sockets
func (relay *Relay) Setup() error {
if relay == nil {
return fmt.Errorf("nil pointer")
}
var err error
err = relay.setupContext()
if err != nil {
return fmt.Errorf("unable to create context %w", err)
}
err = relay.setupPuller()
if err != nil {
return fmt.Errorf("unable create PULL socket %w", err)
}
err = relay.setupPublisher()
if err != nil {
return fmt.Errorf("unable create PUB socket %w", err)
}
err = relay.setupPusher()
if err != nil {
return fmt.Errorf("unable create PUSH socket %w", err)
}
return nil
}
// Cancel shut downs sockets and terminates context
func (relay *Relay) Cancel() {
if relay == nil {
return
}
if relay.publisher != nil {
relay.publisher.Close()
}
if relay.pusher != nil {
relay.pusher.SendBytes([]byte("_"), 0)
}
<-relay.Done()
if relay.puller != nil {
relay.puller.Close()
}
if relay.pusher != nil {
relay.pusher.Close()
}
if relay.ctx != nil {
relay.ctx.Term()
}
relay.publisher = nil
relay.pusher = nil
relay.puller = nil
relay.ctx = nil
}
// Done returns done when relay is finished if nil returns done immediately
func (relay *Relay) Done() <-chan interface{} {
if relay == nil || relay.done == nil {
done := make(chan interface{})
close(done)
return done
}
return relay.done
}
// Work runs relay main loop
func (relay *Relay) Work() {
if relay == nil {
return
}
relay.done = make(chan interface{})
defer close(relay.done)
var chunk []byte
var err error
log.Debug().Msg("Relay entering main loop")
pull:
chunk, err = relay.puller.RecvBytes(0)
if err != nil {
goto fail
}
relay.metrics.MessageIngress()
pub:
_, err = relay.publisher.SendBytes(chunk, 0)
if err != nil {
if err.Error() == "resource temporarily unavailable" {
goto pub
}
goto fail
}
relay.metrics.MessageEgress()
goto pull
fail:
log.Warn().Err(err).Msg("Relay")
switch err {
case zmq4.ErrorNoSocket:
fallthrough
case zmq4.ErrorSocketClosed:
fallthrough
case zmq4.ErrorContextClosed:
goto eos
default:
goto pull
}
eos:
log.Debug().Msg("Relay exiting main loop")
return
}
| 21.552511 | 75 | 0.683898 |
bcd76c884479cb553649a48ac3a12a61fcefd6c0
| 412 |
js
|
JavaScript
|
Commands/enable.js
|
sam6321/DDFC-OVA-Dicsord-Bot
|
939f0c1838402bdbddfb35bd250941022345d642
|
[
"MIT"
] | null | null | null |
Commands/enable.js
|
sam6321/DDFC-OVA-Dicsord-Bot
|
939f0c1838402bdbddfb35bd250941022345d642
|
[
"MIT"
] | null | null | null |
Commands/enable.js
|
sam6321/DDFC-OVA-Dicsord-Bot
|
939f0c1838402bdbddfb35bd250941022345d642
|
[
"MIT"
] | null | null | null |
exports.description = "Enables a command. Shorthand for (prefix)config remove disabled (command).";
exports.usage = "*enable (command)";
exports.info = module.exports.description;
exports.category = "administration";
exports.call = async function (context)
{
let config = require("../Commands/config.js");
context.setArgs("config remove disabled " + context.args[1]);
await config.call(context);
};
| 34.333333 | 99 | 0.723301 |
bef01c04293cdfa79cd2a2d37e72864aa7c7b792
| 6,997 |
html
|
HTML
|
generated/ja/page265.html
|
tuat-static-syllabus/tuat-static-syllabus.github.io
|
ad70b206acee2efd03e76744f2d810527f734a6a
|
[
"MIT"
] | null | null | null |
generated/ja/page265.html
|
tuat-static-syllabus/tuat-static-syllabus.github.io
|
ad70b206acee2efd03e76744f2d810527f734a6a
|
[
"MIT"
] | null | null | null |
generated/ja/page265.html
|
tuat-static-syllabus/tuat-static-syllabus.github.io
|
ad70b206acee2efd03e76744f2d810527f734a6a
|
[
"MIT"
] | null | null | null |
---
{"title":"授業一覧","permalink":"/ja/page265.html","layout":"subject_list","texts":{"filters":"フィルタ:","results":"結果一覧 (%TOTAL%件)","semester":"開講期","title":"科目名","instructor":"担当教員","day_period":"曜日・時限","year":"対象年次","prev":"前へ","next":"次へ","filter_year":"開講年度","filter_faculty":"開講学部"},"contents":{"pages":{"now":265,"maximum":false,"indices":[259,260,261,262,263,264,265,266,267,268,269,270,271]},"total":29956,"filters":[{"title":"表示言語","value":"日本語"}],"subjects":[{"href":"/ja/2019/06/1068112.html","semester":"通年","title":"産業技術実践研究Ⅱ","instructor":"齋藤 拓","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068113.html","semester":"通年","title":"産業技術実践研究Ⅱ","instructor":"寺田 昭彦","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068114.html","semester":"通年","title":"産業技術実践研究Ⅱ","instructor":"夏 恒","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068115.html","semester":"通年","title":"産業技術実践研究Ⅱ","instructor":"並木 美太郎","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068116.html","semester":"通年","title":"産業技術実践研究Ⅱ","instructor":"津川 若子, 長澤 和夫","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068117.html","semester":"通年","title":"産業技術実践研究Ⅱ","instructor":"和田 正義","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068120.html","semester":"通年","title":"産業技術実践研究Ⅱ","instructor":"山田 浩史","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068121.html","semester":"通年","title":"ケーススタディ","instructor":"長澤 和夫","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068122.html","semester":"通年","title":"ケーススタディ","instructor":"齋藤 拓","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068123.html","semester":"通年","title":"ケーススタディ","instructor":"寺田 昭彦","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068124.html","semester":"通年","title":"ケーススタディ","instructor":"夏 恒","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068125.html","semester":"通年","title":"ケーススタディ","instructor":"並木 美太郎","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068126.html","semester":"通年","title":"ケーススタディ","instructor":"津川 若子, 長澤 和夫","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068127.html","semester":"通年","title":"ケーススタディ","instructor":"和田 正義","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068130.html","semester":"通年","title":"ケーススタディ","instructor":"山田 浩史","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068131.html","semester":"1学期","title":"プレゼンテーション実習Ⅰ","instructor":"長澤 和夫","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068132.html","semester":"1学期","title":"プレゼンテーション実習Ⅰ","instructor":"齋藤 拓","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068133.html","semester":"1学期","title":"プレゼンテーション実習Ⅰ","instructor":"寺田 昭彦","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068134.html","semester":"1学期","title":"プレゼンテーション実習Ⅰ","instructor":"夏 恒","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068135.html","semester":"1学期","title":"プレゼンテーション実習Ⅰ","instructor":"並木 美太郎","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068136.html","semester":"1学期","title":"プレゼンテーション実習Ⅰ","instructor":"津川 若子","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068137.html","semester":"1学期","title":"プレゼンテーション実習Ⅰ","instructor":"和田 正義","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068140.html","semester":"1学期","title":"プレゼンテーション実習Ⅰ","instructor":"山田 浩史","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068141.html","semester":"3学期","title":"プレゼンテーション実習Ⅱ","instructor":"長澤 和夫","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068142.html","semester":"3学期","title":"プレゼンテーション実習Ⅱ","instructor":"齋藤 拓","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068143.html","semester":"3学期","title":"プレゼンテーション実習Ⅱ","instructor":"寺田 昭彦","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068144.html","semester":"3学期","title":"プレゼンテーション実習Ⅱ","instructor":"夏 恒","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068145.html","semester":"3学期","title":"プレゼンテーション実習Ⅱ","instructor":"並木 美太郎","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068146.html","semester":"3学期","title":"プレゼンテーション実習Ⅱ","instructor":"津川 若子, 長澤 和夫","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068147.html","semester":"3学期","title":"プレゼンテーション実習Ⅱ","instructor":"和田 正義","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068150.html","semester":"3学期","title":"プレゼンテーション実習Ⅱ","instructor":"山田 浩史","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068151.html","semester":"1学期","title":"プレゼンテーション実習Ⅲ","instructor":"長澤 和夫","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068152.html","semester":"1学期","title":"プレゼンテーション実習Ⅲ","instructor":"齋藤 拓","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068153.html","semester":"1学期","title":"プレゼンテーション実習Ⅲ","instructor":"寺田 昭彦","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068154.html","semester":"1学期","title":"プレゼンテーション実習Ⅲ","instructor":"夏 恒","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068155.html","semester":"1学期","title":"プレゼンテーション実習Ⅲ","instructor":"並木 美太郎","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068156.html","semester":"1学期","title":"プレゼンテーション実習Ⅲ","instructor":"津川 若子","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068157.html","semester":"1学期","title":"プレゼンテーション実習Ⅲ","instructor":"和田 正義","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068160.html","semester":"1学期","title":"プレゼンテーション実習Ⅲ","instructor":"山田 浩史","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068161.html","semester":"3学期","title":"プレゼンテーション実習Ⅳ","instructor":"長澤 和夫","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068162.html","semester":"3学期","title":"プレゼンテーション実習Ⅳ","instructor":"齋藤 拓","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068163.html","semester":"3学期","title":"プレゼンテーション実習Ⅳ","instructor":"寺田 昭彦","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068164.html","semester":"3学期","title":"プレゼンテーション実習Ⅳ","instructor":"夏 恒","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068165.html","semester":"3学期","title":"プレゼンテーション実習Ⅳ","instructor":"並木 美太郎","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068166.html","semester":"3学期","title":"プレゼンテーション実習Ⅳ","instructor":"津川 若子, 長澤 和夫","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068167.html","semester":"3学期","title":"プレゼンテーション実習Ⅳ","instructor":"和田 正義","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068170.html","semester":"3学期","title":"プレゼンテーション実習Ⅳ","instructor":"山田 浩史","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068171.html","semester":"通年","title":"インターンシップ","instructor":"長澤 和夫","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068172.html","semester":"通年","title":"インターンシップ","instructor":"齋藤 拓","day_period":"集中","year":{"id":11}},{"href":"/ja/2019/06/1068173.html","semester":"通年","title":"インターンシップ","instructor":"寺田 昭彦","day_period":"集中","year":{"id":11}}]}}
---
| 2,332.333333 | 6,989 | 0.637845 |
8057ebb6da908ceea94a5792205e40f38dded64a
| 36,716 |
swift
|
Swift
|
FlexLayout/ViewController/LayoutViewController.swift
|
anthann/yoga-demo
|
bf3a539e415f76ec59e7b4dc236030381d673d77
|
[
"MIT"
] | 1 |
2019-04-26T05:28:08.000Z
|
2019-04-26T05:28:08.000Z
|
FlexLayout/ViewController/LayoutViewController.swift
|
anthann/yoga-demo
|
bf3a539e415f76ec59e7b4dc236030381d673d77
|
[
"MIT"
] | null | null | null |
FlexLayout/ViewController/LayoutViewController.swift
|
anthann/yoga-demo
|
bf3a539e415f76ec59e7b4dc236030381d673d77
|
[
"MIT"
] | null | null | null |
//
// LayoutViewController.swift
// FlexLayout
//
// Created by anthann on 2019/4/22.
// Copyright © 2019 anthann. All rights reserved.
//
import UIKit
import YogaKit
import IHKeyboardAvoiding
protocol LayoutViewControllerProtocol: AnyObject {
func onTapAddSubView(sender: LayoutViewController)
func onTapRemoveView(sender: LayoutViewController, view: UIView)
func setNeedsLayoutComponent(sender: LayoutViewController)
}
class LayoutViewController: UIViewController {
enum Sections: Int {
case addNode = 0
case direction
case flexDirection
case justifyContent
case bgs
case alignItems
case alignSelf
case alignContent
case flexWrap
case positionType
case size
case maxSize
case minSize
case padding
case margin
case position
case max
}
lazy var tableView: UITableView = {
let tableView = UITableView()
tableView.allowsSelection = true
tableView.delegate = self
tableView.dataSource = self
tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 60))
tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: 300, height: 60))
tableView.register(AddNodeTableViewCell.self, forCellReuseIdentifier: AddNodeTableViewCell.ReuseIdentifier)
tableView.register(DropDownTableViewCell.self, forCellReuseIdentifier: DropDownTableViewCell.ReuseIdentifier)
tableView.register(PaddingTableViewCell.self, forCellReuseIdentifier: PaddingTableViewCell.ReuseIdentifier)
tableView.register(SizeTableViewCell.self, forCellReuseIdentifier: SizeTableViewCell.ReuseIdentifier)
tableView.register(BGSTableViewCell.self, forCellReuseIdentifier: BGSTableViewCell.ReuseIdentifier)
return tableView
}()
weak var delegate: LayoutViewControllerProtocol?
weak var currentTarget: UIView? {
didSet {
tableView.reloadData()
tableView.tableHeaderView?.backgroundColor = currentTarget?.backgroundColor
tableView.tableFooterView?.backgroundColor = currentTarget?.backgroundColor
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
view.addSubview(tableView)
tableView.snp.makeConstraints { (make) in
make.edges.equalToSuperview()
}
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
tableView.reloadData()
}
}
extension LayoutViewController: UITableViewDataSource {
func numberOfSections(in tableView: UITableView) -> Int {
return Sections.max.rawValue
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let section = Sections(rawValue: indexPath.section) else {
fatalError()
}
switch section {
case .addNode:
let cell = tableView.dequeueReusableCell(withIdentifier: AddNodeTableViewCell.ReuseIdentifier) as! AddNodeTableViewCell
cell.delegate = self
return cell
case .direction:
let cell = tableView.dequeueReusableCell(withIdentifier: DropDownTableViewCell.ReuseIdentifier) as! DropDownTableViewCell
cell.title = currentTarget?.layoutModel?.direction.title
return cell
case .flexDirection:
let cell = tableView.dequeueReusableCell(withIdentifier: DropDownTableViewCell.ReuseIdentifier) as! DropDownTableViewCell
cell.title = currentTarget?.layoutModel?.flexDirection.title
return cell
case .justifyContent:
let cell = tableView.dequeueReusableCell(withIdentifier: DropDownTableViewCell.ReuseIdentifier) as! DropDownTableViewCell
cell.title = currentTarget?.layoutModel?.justifyContent.title
return cell
case .alignItems:
let cell = tableView.dequeueReusableCell(withIdentifier: DropDownTableViewCell.ReuseIdentifier) as! DropDownTableViewCell
cell.title = currentTarget?.layoutModel?.alignItems.title
return cell
case .alignSelf:
let cell = tableView.dequeueReusableCell(withIdentifier: DropDownTableViewCell.ReuseIdentifier) as! DropDownTableViewCell
cell.title = currentTarget?.layoutModel?.alignSelf.title
return cell
case .alignContent:
let cell = tableView.dequeueReusableCell(withIdentifier: DropDownTableViewCell.ReuseIdentifier) as! DropDownTableViewCell
cell.title = currentTarget?.layoutModel?.alignContent.title
return cell
case .flexWrap:
let cell = tableView.dequeueReusableCell(withIdentifier: DropDownTableViewCell.ReuseIdentifier) as! DropDownTableViewCell
cell.title = currentTarget?.layoutModel?.flexWrap.title
return cell
case .positionType:
let cell = tableView.dequeueReusableCell(withIdentifier: DropDownTableViewCell.ReuseIdentifier) as! DropDownTableViewCell
cell.title = currentTarget?.layoutModel?.position.title
return cell
case .padding:
let cell = tableView.dequeueReusableCell(withIdentifier: PaddingTableViewCell.ReuseIdentifier) as! PaddingTableViewCell
cell.label.text = "PADDING"
cell.leftTextField.placeholder = "0"
cell.rightTextField.placeholder = "0"
cell.topTextField.placeholder = "0"
cell.bottomTextField.placeholder = "0"
cell.leftTextField.delegate = self
cell.rightTextField.delegate = self
cell.topTextField.delegate = self
cell.bottomTextField.delegate = self
cell.leftTextField.addTarget(self, action: #selector(didPaddingChanged), for: .editingChanged)
cell.rightTextField.addTarget(self, action: #selector(didPaddingChanged), for: .editingChanged)
cell.topTextField.addTarget(self, action: #selector(didPaddingChanged), for: .editingChanged)
cell.bottomTextField.addTarget(self, action: #selector(didPaddingChanged), for: .editingChanged)
if let left = currentTarget?.layoutModel?.paddingLeft, case YGValueWrapper.point(let value) = left {
cell.leftTextField.text = String(format: "%.1f", value)
}
if let right = currentTarget?.layoutModel?.paddingRight, case YGValueWrapper.point(let value) = right {
cell.rightTextField.text = String(format: "%.1f", value)
}
if let top = currentTarget?.layoutModel?.paddingTop, case YGValueWrapper.point(let value) = top {
cell.topTextField.text = String(format: "%.1f", value)
}
if let bottom = currentTarget?.layoutModel?.paddingBottom, case YGValueWrapper.point(let value) = bottom {
cell.bottomTextField.text = String(format: "%.1f", value)
}
return cell
case .margin:
let cell = tableView.dequeueReusableCell(withIdentifier: PaddingTableViewCell.ReuseIdentifier) as! PaddingTableViewCell
cell.label.text = "MARGIN"
cell.leftTextField.placeholder = "0"
cell.rightTextField.placeholder = "0"
cell.topTextField.placeholder = "0"
cell.bottomTextField.placeholder = "0"
cell.leftTextField.delegate = self
cell.rightTextField.delegate = self
cell.topTextField.delegate = self
cell.bottomTextField.delegate = self
cell.leftTextField.addTarget(self, action: #selector(didMarginChanged(sender:)), for: .editingChanged)
cell.rightTextField.addTarget(self, action: #selector(didMarginChanged(sender:)), for: .editingChanged)
cell.topTextField.addTarget(self, action: #selector(didMarginChanged(sender:)), for: .editingChanged)
cell.bottomTextField.addTarget(self, action: #selector(didMarginChanged(sender:)), for: .editingChanged)
if let left = currentTarget?.layoutModel?.marginLeft, case YGValueWrapper.point(let value) = left {
cell.leftTextField.text = String(format: "%.1f", value)
}
if let right = currentTarget?.layoutModel?.marginRight, case YGValueWrapper.point(let value) = right {
cell.rightTextField.text = String(format: "%.1f", value)
}
if let top = currentTarget?.layoutModel?.marginTop, case YGValueWrapper.point(let value) = top {
cell.topTextField.text = String(format: "%.1f", value)
}
if let bottom = currentTarget?.layoutModel?.marginBottom, case YGValueWrapper.point(let value) = bottom {
cell.bottomTextField.text = String(format: "%.1f", value)
}
return cell
case .position:
let cell = tableView.dequeueReusableCell(withIdentifier: PaddingTableViewCell.ReuseIdentifier) as! PaddingTableViewCell
cell.label.text = "POSITION"
cell.leftTextField.placeholder = "0"
cell.rightTextField.placeholder = "0"
cell.topTextField.placeholder = "0"
cell.bottomTextField.placeholder = "0"
cell.leftTextField.delegate = self
cell.rightTextField.delegate = self
cell.topTextField.delegate = self
cell.bottomTextField.delegate = self
cell.leftTextField.addTarget(self, action: #selector(didPositionChanged(sender:)), for: .editingChanged)
cell.rightTextField.addTarget(self, action: #selector(didPositionChanged(sender:)), for: .editingChanged)
cell.topTextField.addTarget(self, action: #selector(didPositionChanged(sender:)), for: .editingChanged)
cell.bottomTextField.addTarget(self, action: #selector(didPositionChanged(sender:)), for: .editingChanged)
if let left = currentTarget?.layoutModel?.left, case YGValueWrapper.point(let value) = left {
cell.leftTextField.text = String(format: "%.1f", value)
}
if let right = currentTarget?.layoutModel?.right, case YGValueWrapper.point(let value) = right {
cell.rightTextField.text = String(format: "%.1f", value)
}
if let top = currentTarget?.layoutModel?.top, case YGValueWrapper.point(let value) = top {
cell.topTextField.text = String(format: "%.1f", value)
}
if let bottom = currentTarget?.layoutModel?.bottom, case YGValueWrapper.point(let value) = bottom {
cell.bottomTextField.text = String(format: "%.1f", value)
}
return cell
case .size:
let cell = tableView.dequeueReusableCell(withIdentifier: SizeTableViewCell.ReuseIdentifier) as! SizeTableViewCell
cell.widthTextField.placeholder = "auto"
cell.heightTextField.placeholder = "auto"
cell.widthTextField.delegate = self
cell.heightTextField.delegate = self
cell.widthTextField.addTarget(self, action: #selector(didSizeChanged(sender:)), for: .editingChanged)
cell.heightTextField.addTarget(self, action: #selector(didSizeChanged(sender:)), for: .editingChanged)
if let width = currentTarget?.layoutModel?.width, case YGValueWrapper.point(let value) = width {
cell.widthTextField.text = String(format: "%.1f", value)
}
if let height = currentTarget?.layoutModel?.height, case YGValueWrapper.point(let value) = height {
cell.heightTextField.text = String(format: "%.1f", value)
}
if let sp = currentTarget?.superview, sp.isYogaEnabled == false {
cell.widthTextField.isEnabled = false
cell.heightTextField.isEnabled = false
} else {
cell.widthTextField.isEnabled = true
cell.heightTextField.isEnabled = true
}
return cell
case .maxSize:
let cell = tableView.dequeueReusableCell(withIdentifier: SizeTableViewCell.ReuseIdentifier) as! SizeTableViewCell
cell.widthTextField.placeholder = "undefined"
cell.heightTextField.placeholder = "undefined"
cell.widthTextField.delegate = self
cell.heightTextField.delegate = self
cell.widthTextField.addTarget(self, action: #selector(didMaxSizeChanged(sender:)), for: .editingChanged)
cell.heightTextField.addTarget(self, action: #selector(didMaxSizeChanged(sender:)), for: .editingChanged)
if let width = currentTarget?.layoutModel?.maxWidth, case YGValueWrapper.point(let value) = width {
cell.widthTextField.text = String(format: "%.1f", value)
}
if let height = currentTarget?.layoutModel?.maxHeight, case YGValueWrapper.point(let value) = height {
cell.heightTextField.text = String(format: "%.1f", value)
}
return cell
case .minSize:
let cell = tableView.dequeueReusableCell(withIdentifier: SizeTableViewCell.ReuseIdentifier) as! SizeTableViewCell
cell.widthTextField.placeholder = "undefined"
cell.heightTextField.placeholder = "undefined"
cell.widthTextField.delegate = self
cell.heightTextField.delegate = self
cell.widthTextField.addTarget(self, action: #selector(didMinSizeChanged(sender:)), for: .editingChanged)
cell.heightTextField.addTarget(self, action: #selector(didMinSizeChanged(sender:)), for: .editingChanged)
if let width = currentTarget?.layoutModel?.minWidth, case YGValueWrapper.point(let value) = width {
cell.widthTextField.text = String(format: "%.1f", value)
}
if let height = currentTarget?.layoutModel?.minHeight, case YGValueWrapper.point(let value) = height {
cell.heightTextField.text = String(format: "%.1f", value)
}
return cell
case .bgs:
let cell = tableView.dequeueReusableCell(withIdentifier: BGSTableViewCell.ReuseIdentifier) as! BGSTableViewCell
cell.basisTextField.delegate = self
cell.growTextField.delegate = self
cell.shrinkTextField.delegate = self
cell.basisTextField.addTarget(self, action: #selector(didBGSChanged(sender:)), for: .editingChanged)
cell.growTextField.addTarget(self, action: #selector(didBGSChanged(sender:)), for: .editingChanged)
cell.shrinkTextField.addTarget(self, action: #selector(didBGSChanged(sender:)), for: .editingChanged)
if let basis = currentTarget?.layoutModel?.flexBasis, case YGValueWrapper.point(let value) = basis {
cell.basisTextField.text = String(format: "%.1f", value)
}
if let grow = currentTarget?.layoutModel?.flexGrow {
cell.growTextField.text = String(format: "%.1f", grow)
}
if let shrink = currentTarget?.layoutModel?.flexShrink {
cell.shrinkTextField.text = String(format: "%.1f", shrink)
}
return cell
case .max:
fatalError()
}
}
}
extension LayoutViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
guard let section = Sections(rawValue: section) else {
fatalError()
}
switch section {
case .addNode:
return nil
case .direction:
return "DIRECTION"
case .flexDirection:
return "FLEX DIRECTION"
case .justifyContent:
return "JUSTIFY CONTENT"
case .alignItems:
return "ALIGH ITEMS"
case .alignSelf:
return "ALIGN SELF"
case .alignContent:
return "ALIGN CONTENT"
case .flexWrap:
return "FLEX WRAP"
case .positionType:
return "POSITION TYPE"
case .padding:
return nil
case .margin:
return nil
case .position:
return nil
case .size:
return "WIDTH X HEIGHT"
case .maxSize:
return "MAX_WIDTH X MAX_HEIGHT"
case .minSize:
return "MIN_WIDTH X MIN_HEIGHT"
case .bgs:
return "BASIC GROW SHRINK"
case .max:
fatalError()
}
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
guard let section = Sections(rawValue: section) else {
fatalError()
}
switch section {
case .position:
return CGFloat.leastNormalMagnitude
case .margin:
return CGFloat.leastNormalMagnitude
case .padding:
return CGFloat.leastNormalMagnitude
case .addNode:
return CGFloat.leastNormalMagnitude
case .bgs:
fallthrough
case .direction:
fallthrough
case .size:
fallthrough
case .maxSize:
fallthrough
case .minSize:
fallthrough
case .flexDirection:
fallthrough
case .justifyContent:
fallthrough
case .flexWrap:
fallthrough
case .positionType:
fallthrough
case .alignSelf:
fallthrough
case .alignContent:
fallthrough
case .alignItems:
return 30.0
case .max:
fatalError()
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
guard let section = Sections(rawValue: indexPath.section) else {
fatalError()
}
switch section {
case .addNode:
return 66.0
case .margin:
fallthrough
case .position:
fallthrough
case .padding:
return 110
default:
return 44.0
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
guard let section = Sections(rawValue: indexPath.section) else {
fatalError()
}
switch section {
case .addNode:
break
case .direction:
didTapDirection()
case .flexDirection:
didTapFlexDirection()
case .justifyContent:
didTapJustifyContent()
case .alignItems:
didTapAlighItems()
case .alignSelf:
didTapAlighSelf()
case .alignContent:
didTapAlignContent()
case .flexWrap:
didTapFlexWrap()
case .positionType:
didTapPositionType()
case .bgs:
break
case .padding:
break
case .margin:
break
case .position:
break
case .size:
break
case .minSize:
break
case .maxSize:
break
case .max:
fatalError()
}
}
}
extension LayoutViewController {
private func didTapDirection() {
let indexPath = IndexPath(row: 0, section: Sections.direction.rawValue)
let cell = tableView.cellForRow(at: indexPath)
let ac = UIAlertController(title: "Direction", message: nil, preferredStyle: .actionSheet)
let allValues = YGDirection.allValues
for value in allValues {
ac.addAction(UIAlertAction(title: value.title, style: .default, handler: { [weak self] (action) in
guard let strongSelf = self else {
return
}
strongSelf.currentTarget?.layoutModel?.direction = value
strongSelf.currentTarget?.applyLayoutModel()
strongSelf.tableView.reloadRows(at: [indexPath], with: .automatic)
strongSelf.delegate?.setNeedsLayoutComponent(sender: strongSelf)
}))
}
ac.popoverPresentationController?.sourceView = cell
ac.popoverPresentationController?.permittedArrowDirections = .right
self.present(ac, animated: true, completion: nil)
}
private func didTapFlexDirection() {
let indexPath = IndexPath(row: 0, section: Sections.flexDirection.rawValue)
let cell = tableView.cellForRow(at: indexPath)
let ac = UIAlertController(title: "Flex Direction", message: nil, preferredStyle: .actionSheet)
let allValues = YGFlexDirection.allValues
for value in allValues {
ac.addAction(UIAlertAction(title: value.title, style: .default, handler: { [weak self] (action) in
guard let strongSelf = self else {
return
}
strongSelf.currentTarget?.layoutModel?.flexDirection = value
strongSelf.currentTarget?.applyLayoutModel()
strongSelf.tableView.reloadRows(at: [indexPath], with: .automatic)
strongSelf.delegate?.setNeedsLayoutComponent(sender: strongSelf)
}))
}
ac.popoverPresentationController?.sourceView = cell
ac.popoverPresentationController?.permittedArrowDirections = .right
self.present(ac, animated: true, completion: nil)
}
private func didTapPositionType() {
let indexPath = IndexPath(row: 0, section: Sections.positionType.rawValue)
let cell = tableView.cellForRow(at: indexPath)
let ac = UIAlertController(title: "Position Type", message: nil, preferredStyle: .actionSheet)
let allValues = YGPositionType.allValues
for value in allValues {
ac.addAction(UIAlertAction(title: value.title, style: .default, handler: { [weak self] (action) in
guard let strongSelf = self else {
return
}
strongSelf.currentTarget?.layoutModel?.position = value
strongSelf.currentTarget?.applyLayoutModel()
strongSelf.tableView.reloadRows(at: [indexPath], with: .automatic)
strongSelf.delegate?.setNeedsLayoutComponent(sender: strongSelf)
}))
}
ac.popoverPresentationController?.sourceView = cell
ac.popoverPresentationController?.permittedArrowDirections = .right
self.present(ac, animated: true, completion: nil)
}
private func didTapJustifyContent() {
let indexPath = IndexPath(row: 0, section: Sections.justifyContent.rawValue)
let cell = tableView.cellForRow(at: indexPath)
let ac = UIAlertController(title: "Justify Content", message: nil, preferredStyle: .actionSheet)
let allValues = YGJustify.allValues
for value in allValues {
ac.addAction(UIAlertAction(title: value.title, style: .default, handler: { [weak self] (action) in
guard let strongSelf = self else {
return
}
strongSelf.currentTarget?.layoutModel?.justifyContent = value
strongSelf.currentTarget?.applyLayoutModel()
strongSelf.tableView.reloadRows(at: [indexPath], with: .automatic)
strongSelf.delegate?.setNeedsLayoutComponent(sender: strongSelf)
}))
}
ac.popoverPresentationController?.sourceView = cell
ac.popoverPresentationController?.permittedArrowDirections = .right
self.present(ac, animated: true, completion: nil)
}
private func didTapAlighItems() {
let indexPath = IndexPath(row: 0, section: Sections.alignItems.rawValue)
let cell = tableView.cellForRow(at: indexPath)
let ac = UIAlertController(title: "Align Items", message: nil, preferredStyle: .actionSheet)
let allValues = YGAlign.allValues
for value in allValues {
ac.addAction(UIAlertAction(title: value.title, style: .default, handler: { [weak self] (action) in
guard let strongSelf = self else {
return
}
strongSelf.currentTarget?.layoutModel?.alignItems = value
strongSelf.currentTarget?.applyLayoutModel()
strongSelf.tableView.reloadRows(at: [indexPath], with: .automatic)
strongSelf.delegate?.setNeedsLayoutComponent(sender: strongSelf)
}))
}
ac.popoverPresentationController?.sourceView = cell
ac.popoverPresentationController?.permittedArrowDirections = .right
self.present(ac, animated: true, completion: nil)
}
private func didTapAlignContent() {
let indexPath = IndexPath(row: 0, section: Sections.alignContent.rawValue)
let cell = tableView.cellForRow(at: indexPath)
let ac = UIAlertController(title: "Align Content", message: nil, preferredStyle: .actionSheet)
let allValues = YGAlign.allValues
for value in allValues {
ac.addAction(UIAlertAction(title: value.title, style: .default, handler: { [weak self] (action) in
guard let strongSelf = self else {
return
}
strongSelf.currentTarget?.layoutModel?.alignContent = value
strongSelf.currentTarget?.applyLayoutModel()
strongSelf.tableView.reloadRows(at: [indexPath], with: .automatic)
strongSelf.delegate?.setNeedsLayoutComponent(sender: strongSelf)
}))
}
ac.popoverPresentationController?.sourceView = cell
ac.popoverPresentationController?.permittedArrowDirections = .right
self.present(ac, animated: true, completion: nil)
}
private func didTapAlighSelf() {
let indexPath = IndexPath(row: 0, section: Sections.alignSelf.rawValue)
let cell = tableView.cellForRow(at: indexPath)
let ac = UIAlertController(title: "Align Self", message: nil, preferredStyle: .actionSheet)
let allValues = YGAlign.allValues
for value in allValues {
ac.addAction(UIAlertAction(title: value.title, style: .default, handler: { [weak self] (action) in
guard let strongSelf = self else {
return
}
strongSelf.currentTarget?.layoutModel?.alignSelf = value
strongSelf.currentTarget?.applyLayoutModel()
strongSelf.tableView.reloadRows(at: [indexPath], with: .automatic)
strongSelf.delegate?.setNeedsLayoutComponent(sender: strongSelf)
}))
}
ac.popoverPresentationController?.sourceView = cell
ac.popoverPresentationController?.permittedArrowDirections = .right
self.present(ac, animated: true, completion: nil)
}
private func didTapFlexWrap() {
let indexPath = IndexPath(row: 0, section: Sections.flexWrap.rawValue)
let cell = tableView.cellForRow(at: indexPath)
let ac = UIAlertController(title: "Flex Wrap", message: nil, preferredStyle: .actionSheet)
let allValues = YGWrap.allValues
for value in allValues {
ac.addAction(UIAlertAction(title: value.title, style: .default, handler: { [weak self] (action) in
guard let strongSelf = self else {
return
}
strongSelf.currentTarget?.layoutModel?.flexWrap = value
strongSelf.currentTarget?.applyLayoutModel()
strongSelf.tableView.reloadRows(at: [indexPath], with: .automatic)
strongSelf.delegate?.setNeedsLayoutComponent(sender: strongSelf)
}))
}
ac.popoverPresentationController?.sourceView = cell
ac.popoverPresentationController?.permittedArrowDirections = .right
self.present(ac, animated: true, completion: nil)
}
@objc func didPaddingChanged(sender: UITextField) {
guard let direction = Direction(rawValue: sender.tag) else {
fatalError()
}
if let text = sender.text, !text.isEmpty {
let value: Float = NSString(string: text).floatValue
switch direction {
case .left:
currentTarget?.layoutModel?.paddingLeft = YGValueWrapper.point(value)
case .right:
currentTarget?.layoutModel?.paddingRight = YGValueWrapper.point(value)
case .top:
currentTarget?.layoutModel?.paddingTop = YGValueWrapper.point(value)
case .bottom:
currentTarget?.layoutModel?.paddingBottom = YGValueWrapper.point(value)
}
} else {
switch direction {
case .left:
currentTarget?.layoutModel?.paddingLeft = .point(0)
case .right:
currentTarget?.layoutModel?.paddingRight = .point(0)
case .top:
currentTarget?.layoutModel?.paddingTop = .point(0)
case .bottom:
currentTarget?.layoutModel?.paddingBottom = .point(0)
}
}
currentTarget?.applyLayoutModel()
delegate?.setNeedsLayoutComponent(sender: self)
}
@objc func didMarginChanged(sender: UITextField) {
guard let direction = Direction(rawValue: sender.tag) else {
fatalError()
}
if let text = sender.text, !text.isEmpty {
let value: Float = NSString(string: text).floatValue
switch direction {
case .left:
currentTarget?.layoutModel?.marginLeft = YGValueWrapper.point(value)
case .right:
currentTarget?.layoutModel?.marginRight = YGValueWrapper.point(value)
case .top:
currentTarget?.layoutModel?.marginTop = YGValueWrapper.point(value)
case .bottom:
currentTarget?.layoutModel?.marginBottom = YGValueWrapper.point(value)
}
} else {
switch direction {
case .left:
currentTarget?.layoutModel?.marginLeft = .point(0)
case .right:
currentTarget?.layoutModel?.marginRight = .point(0)
case .top:
currentTarget?.layoutModel?.marginTop = .point(0)
case .bottom:
currentTarget?.layoutModel?.marginBottom = .point(0)
}
}
currentTarget?.applyLayoutModel()
delegate?.setNeedsLayoutComponent(sender: self)
}
@objc func didPositionChanged(sender: UITextField) {
guard let direction = Direction(rawValue: sender.tag) else {
fatalError()
}
if let text = sender.text, !text.isEmpty {
let value: Float = NSString(string: text).floatValue
switch direction {
case .left:
currentTarget?.layoutModel?.left = YGValueWrapper.point(value)
case .right:
currentTarget?.layoutModel?.right = YGValueWrapper.point(value)
case .top:
currentTarget?.layoutModel?.top = YGValueWrapper.point(value)
case .bottom:
currentTarget?.layoutModel?.bottom = YGValueWrapper.point(value)
}
} else {
switch direction {
case .left:
currentTarget?.layoutModel?.left = nil
case .right:
currentTarget?.layoutModel?.right = nil
case .top:
currentTarget?.layoutModel?.top = nil
case .bottom:
currentTarget?.layoutModel?.bottom = nil
}
}
currentTarget?.applyLayoutModel()
delegate?.setNeedsLayoutComponent(sender: self)
}
@objc func didSizeChanged(sender: UITextField) {
guard let dimension = SizeDimension(rawValue: sender.tag) else {
fatalError()
}
if let text = sender.text, !text.isEmpty {
let value: Float = NSString(string: text).floatValue
switch dimension {
case .width:
currentTarget?.layoutModel?.width = YGValueWrapper.point(value)
case .height:
currentTarget?.layoutModel?.height = YGValueWrapper.point(value)
}
} else {
switch dimension {
case .width:
currentTarget?.layoutModel?.width = .auto
case .height:
currentTarget?.layoutModel?.height = .auto
}
}
currentTarget?.applyLayoutModel()
delegate?.setNeedsLayoutComponent(sender: self)
}
@objc func didMaxSizeChanged(sender: UITextField) {
guard let dimension = SizeDimension(rawValue: sender.tag) else {
fatalError()
}
if let text = sender.text, !text.isEmpty {
let value: Float = NSString(string: text).floatValue
switch dimension {
case .width:
currentTarget?.layoutModel?.maxWidth = YGValueWrapper.point(value)
case .height:
currentTarget?.layoutModel?.maxHeight = YGValueWrapper.point(value)
}
} else {
switch dimension {
case .width:
currentTarget?.layoutModel?.maxWidth = .undefined
case .height:
currentTarget?.layoutModel?.maxHeight = .undefined
}
}
currentTarget?.applyLayoutModel()
delegate?.setNeedsLayoutComponent(sender: self)
}
@objc func didMinSizeChanged(sender: UITextField) {
guard let dimension = SizeDimension(rawValue: sender.tag) else {
fatalError()
}
if let text = sender.text, !text.isEmpty {
let value: Float = NSString(string: text).floatValue
switch dimension {
case .width:
currentTarget?.layoutModel?.minWidth = YGValueWrapper.point(value)
case .height:
currentTarget?.layoutModel?.minHeight = YGValueWrapper.point(value)
}
} else {
switch dimension {
case .width:
currentTarget?.layoutModel?.minWidth = .undefined
case .height:
currentTarget?.layoutModel?.minHeight = .undefined
}
}
currentTarget?.applyLayoutModel()
delegate?.setNeedsLayoutComponent(sender: self)
}
@objc func didBGSChanged(sender: UITextField) {
guard let bgs = BGS(rawValue: sender.tag) else {
fatalError()
}
if let text = sender.text, !text.isEmpty {
let value: Float = NSString(string: text).floatValue
switch bgs {
case .basic:
currentTarget?.layoutModel?.flexBasis = YGValueWrapper.point(value)
case .shrink:
currentTarget?.layoutModel?.flexShrink = CGFloat(value)
case .grow:
currentTarget?.layoutModel?.flexGrow = CGFloat(value)
}
} else {
switch bgs {
case .basic:
currentTarget?.layoutModel?.flexBasis = YGValueWrapper.auto
case .shrink:
currentTarget?.layoutModel?.flexShrink = 1.0
case .grow:
currentTarget?.layoutModel?.flexGrow = 0.0
}
}
currentTarget?.applyLayoutModel()
delegate?.setNeedsLayoutComponent(sender: self)
}
}
extension LayoutViewController: AddNodeCellProtocol {
func onAddChildNode(sender: AddNodeTableViewCell, target: UIButton) {
delegate?.onTapAddSubView(sender: self)
}
func onRemoveNode(sender: AddNodeTableViewCell, target: UIButton) {
guard let view = currentTarget else {
return
}
delegate?.onTapRemoveView(sender: self, view: view)
}
}
extension LayoutViewController: UITextFieldDelegate {
func textFieldDidBeginEditing(_ textField: UITextField) {
textField.selectAll(nil)
}
func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
KeyboardAvoiding.setAvoidingView(tableView, withTriggerView: textField)
return true
}
}
| 44.396614 | 133 | 0.617769 |
7502cc388a55322a4f38d0c4291c68a6cc4d8a7f
| 1,368 |
rs
|
Rust
|
src/stss/mod.rs
|
nagashi/The-Traveling-Politician-Problem
|
78bdbf6759ca017a8c863505025b4db7b7734ef0
|
[
"Apache-2.0",
"MIT"
] | 2 |
2020-08-14T13:58:19.000Z
|
2021-04-27T17:34:21.000Z
|
src/stss/mod.rs
|
nagashi/The-Traveling-Politician-Problem
|
78bdbf6759ca017a8c863505025b4db7b7734ef0
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
src/stss/mod.rs
|
nagashi/The-Traveling-Politician-Problem
|
78bdbf6759ca017a8c863505025b4db7b7734ef0
|
[
"Apache-2.0",
"MIT"
] | null | null | null |
// function to convert String to static str.
fn string_to_static_str(s: String) -> &'static str {
Box::leak(s.into_boxed_str())
}
// function to create cypher.csv heading
pub fn title(vec_len: usize) -> Vec<String> {
let mut header: Vec<String> = Vec::new();
for i in 0..vec_len {
match i {
0 => header.push("KEY".to_owned()), // First header column
a if a == (vec_len - 1) => header.push("DISTANCE".to_owned()), // Last header column
_ => {
// Configure header for each state in vector
let mut a: String = "STATE_".to_owned();
let b: String = i.to_string();
let b: &'static str = string_to_static_str(b);
a.push_str(b);
header.push(a);
}
}
}
header // return header
}
// function constructs the rows of cypher.csv
pub fn vec_row(row_num: usize, distance: f64, mut vec_row: Vec<&str>) -> Vec<&str> {
let mut vec: Vec<&str> = Vec::new();
let rownum = format!("{:?}", row_num);
let dist = format!("{:.1}", distance);
let rownum: &'static str = string_to_static_str(rownum);
let dist: &'static str = string_to_static_str(dist);
vec.push(rownum); // Key: row numbers
vec.append(&mut vec_row); // States
vec.push(dist); // Distance
vec // return vec
}
| 33.365854 | 96 | 0.567982 |
85f50c2d6b06b9d4464be140bc46cae7d6113d36
| 2,398 |
c
|
C
|
cmake_targets/lte_build_oai/build/CMakeFiles/X2AP_R14/X2AP_CellToReport-Item.c
|
Cindia-blue/openairue
|
759f58ebe3fcc28600a462a4308c97eed1c8c4b1
|
[
"Apache-2.0"
] | 1 |
2019-08-20T13:10:07.000Z
|
2019-08-20T13:10:07.000Z
|
cmake_targets/lte_build_oai/build/CMakeFiles/X2AP_R14/X2AP_CellToReport-Item.c
|
Cindia-blue/openairue
|
759f58ebe3fcc28600a462a4308c97eed1c8c4b1
|
[
"Apache-2.0"
] | null | null | null |
cmake_targets/lte_build_oai/build/CMakeFiles/X2AP_R14/X2AP_CellToReport-Item.c
|
Cindia-blue/openairue
|
759f58ebe3fcc28600a462a4308c97eed1c8c4b1
|
[
"Apache-2.0"
] | null | null | null |
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "X2AP-PDU-Contents"
* found in "/home/lixh/ue_folder/openair2/X2AP/MESSAGES/ASN1/R14/x2ap-14.6.0.asn1"
* `asn1c -pdu=all -fcompound-names -gen-PER -no-gen-OER -no-gen-example -fno-include-deps -D /home/lixh/ue_folder/cmake_targets/lte_build_oai/build/CMakeFiles/X2AP_R14`
*/
#include "X2AP_CellToReport-Item.h"
#include "X2AP_ProtocolExtensionContainer.h"
static asn_TYPE_member_t asn_MBR_X2AP_CellToReport_Item_1[] = {
{ ATF_NOFLAGS, 0, offsetof(struct X2AP_CellToReport_Item, cell_ID),
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_X2AP_ECGI,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"cell-ID"
},
{ ATF_POINTER, 1, offsetof(struct X2AP_CellToReport_Item, iE_Extensions),
(ASN_TAG_CLASS_CONTEXT | (1 << 2)),
-1, /* IMPLICIT tag at current level */
&asn_DEF_X2AP_ProtocolExtensionContainer_5040P8,
0,
{ 0, 0, 0 },
0, 0, /* No default value */
"iE-Extensions"
},
};
static const int asn_MAP_X2AP_CellToReport_Item_oms_1[] = { 1 };
static const ber_tlv_tag_t asn_DEF_X2AP_CellToReport_Item_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static const asn_TYPE_tag2member_t asn_MAP_X2AP_CellToReport_Item_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cell-ID */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* iE-Extensions */
};
static asn_SEQUENCE_specifics_t asn_SPC_X2AP_CellToReport_Item_specs_1 = {
sizeof(struct X2AP_CellToReport_Item),
offsetof(struct X2AP_CellToReport_Item, _asn_ctx),
asn_MAP_X2AP_CellToReport_Item_tag2el_1,
2, /* Count of tags in the map */
asn_MAP_X2AP_CellToReport_Item_oms_1, /* Optional members */
1, 0, /* Root/Additions */
2, /* First extension addition */
};
asn_TYPE_descriptor_t asn_DEF_X2AP_CellToReport_Item = {
"CellToReport-Item",
"CellToReport-Item",
&asn_OP_SEQUENCE,
asn_DEF_X2AP_CellToReport_Item_tags_1,
sizeof(asn_DEF_X2AP_CellToReport_Item_tags_1)
/sizeof(asn_DEF_X2AP_CellToReport_Item_tags_1[0]), /* 1 */
asn_DEF_X2AP_CellToReport_Item_tags_1, /* Same as above */
sizeof(asn_DEF_X2AP_CellToReport_Item_tags_1)
/sizeof(asn_DEF_X2AP_CellToReport_Item_tags_1[0]), /* 1 */
{ 0, 0, SEQUENCE_constraint },
asn_MBR_X2AP_CellToReport_Item_1,
2, /* Elements count */
&asn_SPC_X2AP_CellToReport_Item_specs_1 /* Additional specs */
};
| 37.46875 | 170 | 0.739366 |
48364bed4bda24a9b270807f43ce04b5a1bd32cd
| 7,176 |
swift
|
Swift
|
ShortcutsKitSwifty/ShortcutsKitSwifty/SCKeyCombo.swift
|
HsiangHo/ShortcutsKit-Swifty
|
92964f8bf3a901d7c3b551ab6d90fd83f48ef644
|
[
"MIT"
] | null | null | null |
ShortcutsKitSwifty/ShortcutsKitSwifty/SCKeyCombo.swift
|
HsiangHo/ShortcutsKit-Swifty
|
92964f8bf3a901d7c3b551ab6d90fd83f48ef644
|
[
"MIT"
] | null | null | null |
ShortcutsKitSwifty/ShortcutsKitSwifty/SCKeyCombo.swift
|
HsiangHo/ShortcutsKit-Swifty
|
92964f8bf3a901d7c3b551ab6d90fd83f48ef644
|
[
"MIT"
] | null | null | null |
//
// SCKeyCombo.swift
// ShortcutsKitSwifty
//
// Created by Jovi on 12/7/19.
// Copyright © 2019 Jovi. All rights reserved.
//
import Cocoa
import Carbon
public class SCKeyCombo: NSObject, NSCoding {
public var keyCode: UInt32
public var keyModifiers: UInt32
public var stringForKeyCombo: String {
var rslt: String = ""
if let modifiers = SCKeyCombo.keyModifiers2String(keyModifiers: keyModifiers) {
rslt = rslt.appending(modifiers)
}
if let key = SCKeyCombo.keyCode2String(keyCode: keyCode, keyModifiers: 0) {
rslt = rslt.appending(key)
}
return rslt
}
public init(keyCode: Int, keyModifiers: Int) {
self.keyCode = UInt32(keyCode)
self.keyModifiers = UInt32(keyModifiers)
super.init()
}
public required init?(coder: NSCoder) {
keyCode = (coder.decodeObject(forKey: "keyCode") as! NSNumber).uint32Value
keyModifiers = (coder.decodeObject(forKey: "keyModifiers") as! NSNumber).uint32Value
}
public func encode(with coder: NSCoder) {
coder.encode(NSNumber.init(value: keyCode), forKey: "keyCode")
coder.encode(NSNumber.init(value: keyModifiers), forKey: "keyModifiers")
}
public override func isEqual(_ object: Any?) -> Bool {
var rslt = false
if let obj = object as? SCKeyCombo {
rslt = ((obj.keyCode == self.keyCode) && (obj.keyModifiers == self.keyModifiers))
}
return rslt
}
}
extension SCKeyCombo {
private static func specialkeyCode2String(keyCode: UInt32) -> String? {
func NSStringFromKeyCode(_ keyCode: UInt32) -> String {
return NSString.init(format: "%C", keyCode) as String
}
func NSNumberFromKeyCode(_ keyCode: Int) -> NSNumber {
return NSNumber.init(value: keyCode)
}
var dictSpecialKeyCode2String: [NSObject: String] = [:]
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F1)] = "F1"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F2)] = "F2"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F3)] = "F3"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F4)] = "F4"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F5)] = "F5"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F6)] = "F6"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F7)] = "F7"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F8)] = "F8"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F9)] = "F9"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F10)] = "F10"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F11)] = "F11"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F12)] = "F12"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F13)] = "F13"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F14)] = "F14"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F15)] = "F15"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F16)] = "F16"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F17)] = "F17"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F18)] = "F18"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F19)] = "F19"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_F20)] = "F20"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_Space)] = "Space"
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_Delete)] = NSStringFromKeyCode(0x232B)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_ForwardDelete)] = NSStringFromKeyCode(0x2326)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_ANSI_Keypad0)] = NSStringFromKeyCode(0x2327)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_LeftArrow)] = NSStringFromKeyCode(0x2190)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_RightArrow)] = NSStringFromKeyCode(0x2192)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_UpArrow)] = NSStringFromKeyCode(0x2191)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_DownArrow)] = NSStringFromKeyCode(0x2193)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_End)] = NSStringFromKeyCode(0x2198)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_Home)] = NSStringFromKeyCode(0x2196)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_Escape)] = NSStringFromKeyCode(0x238B)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_PageDown)] = NSStringFromKeyCode(0x21DF)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_PageUp)] = NSStringFromKeyCode(0x21DE)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_Return)] = NSStringFromKeyCode(0x21A9)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_ANSI_KeypadEnter)] = NSStringFromKeyCode(0x2305)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_Tab)] = NSStringFromKeyCode(0x21E5)
dictSpecialKeyCode2String[NSNumberFromKeyCode(kVK_Help)] = "?⃝"
return dictSpecialKeyCode2String[NSNumberFromKeyCode(Int(keyCode))]
}
}
extension SCKeyCombo {
public static func keyCode2String(keyCode: UInt32, keyModifiers: UInt32) -> String? {
var rslt = specialkeyCode2String(keyCode: keyCode)
if nil != rslt {
return rslt
}
let currentKeyboard = TISCopyCurrentASCIICapableKeyboardLayoutInputSource().takeUnretainedValue()
let rawLayoutData = TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData)
let layoutData = unsafeBitCast(rawLayoutData, to: CFData.self)
let layout: UnsafePointer<UCKeyboardLayout> = unsafeBitCast(CFDataGetBytePtr(layoutData), to: UnsafePointer<UCKeyboardLayout>.self)
var deadKeyState: UInt32 = 0
var chars: [UniChar] = [0]
var realLength: Int = 0
let modifierKeyState: UInt32 = (keyModifiers >> 8) & 0xff
let result = UCKeyTranslate(layout,
UInt16(keyCode),
UInt16(kUCKeyActionDown),
modifierKeyState,
UInt32(LMGetKbdType()),
OptionBits(kUCKeyTranslateNoDeadKeysBit),
&deadKeyState,
4,
&realLength,
&chars)
if noErr == result {
rslt = NSString.init(characters: chars, length: realLength) as String
}
return rslt
}
public static func keyModifiers2String(keyModifiers: UInt32) -> String? {
var rslt: String = ""
let modifiers = Int(keyModifiers)
if (modifiers & shiftKey) == shiftKey {
rslt = rslt.appending("⇧")
}
if (modifiers & controlKey) == controlKey {
rslt = rslt.appending("⌃")
}
if (modifiers & optionKey) == optionKey {
rslt = rslt.appending("⌥")
}
if (modifiers & cmdKey) == cmdKey {
rslt = rslt.appending("⌘")
}
return rslt == "" ? nil : rslt
}
}
| 45.707006 | 139 | 0.668757 |
f06e06965b7f1b5220c96fb081f4691448e98901
| 1,437 |
kt
|
Kotlin
|
kotlin/src/main/kotlin/modules/GuestBookModule.kt
|
mandm-pt/languages
|
eecc58a631059a2f1594fe696f10c4b350ce5de0
|
[
"MIT"
] | 1 |
2020-08-05T13:49:55.000Z
|
2020-08-05T13:49:55.000Z
|
kotlin/src/main/kotlin/modules/GuestBookModule.kt
|
mandm-pt/languages
|
eecc58a631059a2f1594fe696f10c4b350ce5de0
|
[
"MIT"
] | null | null | null |
kotlin/src/main/kotlin/modules/GuestBookModule.kt
|
mandm-pt/languages
|
eecc58a631059a2f1594fe696f10c4b350ce5de0
|
[
"MIT"
] | null | null | null |
package modules
import HttpUtils.Companion.writeResponseText
import com.sun.net.httpserver.HttpExchange
import java.net.URLDecoder
import java.nio.charset.StandardCharsets
import java.text.SimpleDateFormat
import java.util.*
class GuestBookModule : BaseModule("GuestBookModule") {
private val path = "/Guest"
private val guestsMessages = mutableListOf<String>()
override fun canProcess(http: HttpExchange) = http.requestURI.rawPath.equals(path, true)
override fun processingLogic(http: HttpExchange) {
if (http.requestMethod == "POST") {
tryAddGuest(http)
}
showPage(http)
}
private fun tryAddGuest(http: HttpExchange) {
val text = String(http.requestBody.readAllBytes(), StandardCharsets.ISO_8859_1)
if (text.startsWith("message=", true)) {
val message = URLDecoder.decode(text.split("=")[1])
val currentTime = SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(Date())
guestsMessages += "$currentTime - $message"
}
}
private fun showPage(http: HttpExchange) {
var pageHtml = "<ul>"
for (message in guestsMessages)
pageHtml += "<li>$message</li>"
pageHtml += """</ul>
<form method='post'>
<label for='message'>Message</label>
<input name='message' id='message' autofocus>
</form>"""
http.writeResponseText(pageHtml)
}
}
| 28.74 | 92 | 0.64579 |
f06254702e8bbcfeb44e5b0efc3aafa3fdd0c1c9
| 585 |
js
|
JavaScript
|
test/browser/bootstrap.js
|
reflectivedevelopment/image-js
|
9eb6e7feee304140b6648e003e18f7497a7e7dab
|
[
"MIT"
] | 1 |
2020-12-01T09:18:39.000Z
|
2020-12-01T09:18:39.000Z
|
test/browser/bootstrap.js
|
reflectivedevelopment/image-js
|
9eb6e7feee304140b6648e003e18f7497a7e7dab
|
[
"MIT"
] | null | null | null |
test/browser/bootstrap.js
|
reflectivedevelopment/image-js
|
9eb6e7feee304140b6648e003e18f7497a7e7dab
|
[
"MIT"
] | 1 |
2021-01-05T17:37:03.000Z
|
2021-01-05T17:37:03.000Z
|
'use strict';
import Image from '../../src';
import {imageList, getHash} from '../test-util';
window.images = imageList;
window.getHash = getHash;
let root = '../img/';
window.load = function load(name) {
return Image.load(root + name);
};
var left = document.getElementById('left');
window.setLeft = function setLeft(img) {
left.innerHTML = '';
left.appendChild(img.getCanvas());
};
var right = document.getElementById('right');
window.setRight = function setRight(img) {
right.innerHTML = '';
right.appendChild(img.getCanvas());
};
module.exports = Image;
| 20.892857 | 48 | 0.671795 |
28debae7724909a4f07d42b71c9a3cf88593fc10
| 231 |
rb
|
Ruby
|
app/models/user.rb
|
mattream15/DreamTech-Cannabis-Productions-Network
|
928faad3869469ea54e0a9e4ca137019439683a5
|
[
"MIT"
] | null | null | null |
app/models/user.rb
|
mattream15/DreamTech-Cannabis-Productions-Network
|
928faad3869469ea54e0a9e4ca137019439683a5
|
[
"MIT"
] | 1 |
2021-09-27T23:34:29.000Z
|
2021-09-27T23:34:29.000Z
|
app/models/user.rb
|
mattream15/DreamTech-Cannabis-Productions-Network
|
928faad3869469ea54e0a9e4ca137019439683a5
|
[
"MIT"
] | null | null | null |
class User < ActiveRecord::Base
has_many :grow_rooms
has_many :cannabis_plants
has_secure_password
validates :address, uniqueness: true
validates :email, uniqueness: true
validates :name, presence: true
end
| 25.666667 | 40 | 0.74026 |
9c597891f9d86312105d60285c2cb98283cbb56c
| 4,320 |
js
|
JavaScript
|
src/app/components/histreepage/HistreePage.js
|
LeonYuAng3NT/ACP
|
64e46a845a38f9d4d9432a3b13f4c316e903153d
|
[
"MIT"
] | 1 |
2021-05-20T23:36:51.000Z
|
2021-05-20T23:36:51.000Z
|
src/app/components/histreepage/HistreePage.js
|
LeonYuAng3NT/ACP
|
64e46a845a38f9d4d9432a3b13f4c316e903153d
|
[
"MIT"
] | null | null | null |
src/app/components/histreepage/HistreePage.js
|
LeonYuAng3NT/ACP
|
64e46a845a38f9d4d9432a3b13f4c316e903153d
|
[
"MIT"
] | null | null | null |
/*
* Craeted by Cyferouss on 03-27-2017
*/
import React from 'react';
import style from './style.css';
import 'bootstrap/less/bootstrap.less';
import Jumbotron from 'react-bootstrap/lib/Jumbotron';
import Grid from 'react-bootstrap/lib/Grid';
import Button from 'react-bootstrap/lib/Button';
import ButtonGroup from 'react-bootstrap/lib/ButtonGroup';
import DropdownButton from 'react-bootstrap/lib/DropdownButton';
import MenuItem from 'react-bootstrap/lib/MenuItem';
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';
import Carousel from 'react-bootstrap/lib/Carousel';
import Image from 'react-bootstrap/lib/Image';
import Thumbnail from 'react-bootstrap/lib/Thumbnail';
import PageHeader from 'react-bootstrap/lib/PageHeader';
import Panel from 'react-bootstrap/lib/Panel';
import {browserHistory} from 'react-router'
import utils from '../Utils';
const lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"
export default class HistreePage extends React.Component {
constructor(props){
super(props)
this.state = {
nodes:null,
massage:'',
images: [],
list:null,
}
}
componentDidMount() {
console.log("[Product]: DID MOUNT")
window.scrollTo(0, 0)
}
successor(name){
var successor = [];
for (i = 0; i < this.state.list.length; i++) {
if(this.state.list[i].parent === name){
var removed = this.state.list.splice(i,1);
successor.push(removed);
}
}
return successor;
}
bfs(root){
var fifo = [root];
while(fifo.length < 1){
var current = fifo.splice(0,1);
if(current.name === this.state.product){
this.state.image.push(current.imageURL);
return;
}else{
fifo.push(this.successor(current));
this.state.image.push(current.imageURL);
}
}
}
render() {
let title = 'Gumi Megpoid'
let author = 'Cyferouss And Yanbo'
let description = lorem
let callback = (data) =>{
this.setState({massage: data.massage});
if(data.error == true){
return;
}
else if(data.isroot){
this.setState({images: [data.root.imageURL]});
}
else{
this.setState({list: data.nodes});
this.bfs(data.root);
this.state.images.push(data.root.imageURL);
}
}
return (
<Grid>
<PageHeader> {title} </PageHeader>
<Row>
<Col md={12}>
<ButtonGroup justified>
<ButtonGroup justified>
<DropdownButton bsStyle = 'success' title="View" id="bg-justified-dropdown">
<MenuItem eventKey="1" onClick={() => this.setState({panel_view: 'tree'})} >Tree View</MenuItem>
<MenuItem eventKey="2" onClick={() => this.setState({panel_view: 'list'})} >List View</MenuItem>
</DropdownButton>
</ButtonGroup>
<ButtonGroup>
<Button bsStyle = 'warning' onClick={() => browserHistory.push('/requests')}>Pending Requests</Button>
</ButtonGroup>
<ButtonGroup>
<Button bsStyle = 'info'> History </Button>
</ButtonGroup>
</ButtonGroup>
<Panel header="Tree View" id={style.Margined}>
<div>
<p>
Tree renders in here... panel should be a div, but theres a div component as well to use if you need it.
</p>
</div>
</Panel>
</Col>
</Row>
<hr/>
<Row>
<Col md={4}>
<Panel header="Description" id={style.Margined}>
<h2> {author} </h2>
<hr/>
<p> {description} </p>
</Panel>
</Col>
<Col md={8}>
<Panel header="Comments" id={style.Margined}>
<p> Render comment components in here... </p>
</Panel>
</Col>
</Row>
{}
</Grid>
)
}
}
| 30.20979 | 460 | 0.603009 |
cb5a672e0293b3acfe68504987cf0003fd7d8176
| 226 |
h
|
C
|
Example/XTImgTitleSubTitleCell/XTViewController.h
|
XiangtaiCompany/-XTImgTitleSubTitleCell
|
e31fe879ff49e2c6133491f354cc0637bf3aed85
|
[
"MIT"
] | null | null | null |
Example/XTImgTitleSubTitleCell/XTViewController.h
|
XiangtaiCompany/-XTImgTitleSubTitleCell
|
e31fe879ff49e2c6133491f354cc0637bf3aed85
|
[
"MIT"
] | null | null | null |
Example/XTImgTitleSubTitleCell/XTViewController.h
|
XiangtaiCompany/-XTImgTitleSubTitleCell
|
e31fe879ff49e2c6133491f354cc0637bf3aed85
|
[
"MIT"
] | null | null | null |
//
// XTViewController.h
// XTImgTitleSubTitleCell
//
// Created by bubiqudong on 10/12/2017.
// Copyright (c) 2017 bubiqudong. All rights reserved.
//
@import UIKit;
@interface XTViewController : UIViewController
@end
| 16.142857 | 55 | 0.725664 |
3a0e5275ae03ff90595ec2c269cdc92d1f8fc683
| 302 |
sql
|
SQL
|
Ejemplos Scripts MSSQL/06 Triggers/03 PruebaAfterUpdate.sql
|
ejpcr/lib-mssql
|
e6c5db444aeca24eee86a41f90deb5a38e309f7a
|
[
"MIT"
] | null | null | null |
Ejemplos Scripts MSSQL/06 Triggers/03 PruebaAfterUpdate.sql
|
ejpcr/lib-mssql
|
e6c5db444aeca24eee86a41f90deb5a38e309f7a
|
[
"MIT"
] | null | null | null |
Ejemplos Scripts MSSQL/06 Triggers/03 PruebaAfterUpdate.sql
|
ejpcr/lib-mssql
|
e6c5db444aeca24eee86a41f90deb5a38e309f7a
|
[
"MIT"
] | null | null | null |
USE Aromatherapy
GO
-- Show the contents before the trigger is run
SELECT * from TriggerMessages
-- Issue the command that will invoke the trigger
UPDATE Oils
SET Description = 'New Description'
WHERE OilName = 'Clary Sage'
-- Show the contents after the trigger is run
SELECT * FROM TriggerMessages
| 23.230769 | 49 | 0.781457 |
b6a7d2004364050843515c4e6534e02878014f05
| 1,233 |
rb
|
Ruby
|
lib/responses/notifications.rb
|
JPanian/developer.github.com
|
a03030dea7be744a3feff20ea29f51783f37a47f
|
[
"CC0-1.0"
] | 793 |
2015-01-05T05:17:49.000Z
|
2022-03-26T21:54:49.000Z
|
lib/responses/notifications.rb
|
sarahs/developer.github.com
|
b30e47ca4d9d812394fc94bdfb24daf1192dd192
|
[
"CC0-1.0"
] | 165 |
2015-01-08T19:49:40.000Z
|
2016-09-05T03:11:30.000Z
|
lib/responses/notifications.rb
|
sarahs/developer.github.com
|
b30e47ca4d9d812394fc94bdfb24daf1192dd192
|
[
"CC0-1.0"
] | 827 |
2015-01-03T13:01:13.000Z
|
2022-02-28T03:17:27.000Z
|
require_relative 'repos'
module GitHub
module Resources
module Responses
THREAD ||= {
:id => "1",
:repository => SIMPLE_REPO,
:subject => {
:title => "Greetings",
:url => "https://api.github.com/repos/octokit/octokit.rb/issues/123",
:latest_comment_url => "https://api.github.com/repos/octokit/octokit.rb/issues/comments/123",
:type => "Issue"
},
:reason => 'subscribed',
:unread => true,
:updated_at => '2014-11-07T22:01:45Z',
:last_read_at => '2014-11-07T22:01:45Z',
:url => "https://api.github.com/notifications/threads/1"
}
SUBSCRIPTION ||= {
:subscribed => true,
:ignored => false,
:reason => nil,
:created_at => "2012-10-06T21:34:12Z",
:url => "https://api.github.com/notifications/threads/1/subscription",
:thread_url => "https://api.github.com/notifications/threads/1"
}
REPO_SUBSCRIPTION ||= SUBSCRIPTION.merge \
:url => "https://api.github.com/repos/octocat/example/subscription",
:repository_url => "https://api.github.com/repos/octocat/example"
REPO_SUBSCRIPTION.delete :thread_url
end
end
end
| 32.447368 | 103 | 0.58232 |
9bc8179212408df96a2e3a254c86879834d17912
| 136 |
js
|
JavaScript
|
Unit-6/unit-6_lesson-1-code-challenge-intro-to-jquery_lee-wilson/main.js
|
indefinitelee/JSC
|
184ef69a775b8e5da222d30841c581e6f51aaa6f
|
[
"MIT"
] | null | null | null |
Unit-6/unit-6_lesson-1-code-challenge-intro-to-jquery_lee-wilson/main.js
|
indefinitelee/JSC
|
184ef69a775b8e5da222d30841c581e6f51aaa6f
|
[
"MIT"
] | null | null | null |
Unit-6/unit-6_lesson-1-code-challenge-intro-to-jquery_lee-wilson/main.js
|
indefinitelee/JSC
|
184ef69a775b8e5da222d30841c581e6f51aaa6f
|
[
"MIT"
] | null | null | null |
//Introducing jQuery
$(function() {
console.log("Hello world");
$("#thumbnails");
$(".thumbnail");
$("ul");
$("ul li");
});
| 15.111111 | 29 | 0.514706 |
e449b287a88e69b5759519061cf8c72a7fd34069
| 572 |
asm
|
Assembly
|
oeis/058/A058344.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 11 |
2021-08-22T19:44:55.000Z
|
2022-03-20T16:47:57.000Z
|
oeis/058/A058344.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 9 |
2021-08-29T13:15:54.000Z
|
2022-03-09T19:52:31.000Z
|
oeis/058/A058344.asm
|
neoneye/loda-programs
|
84790877f8e6c2e821b183d2e334d612045d29c0
|
[
"Apache-2.0"
] | 3 |
2021-08-22T20:56:47.000Z
|
2021-09-29T06:26:12.000Z
|
; A058344: Difference between the sum of the odd aliquot divisors of n and the sum of the even aliquot divisors of n.
; 0,1,1,-1,1,2,1,-5,4,4,1,-8,1,6,9,-13,1,5,1,-10,11,10,1,-28,6,12,13,-12,1,6,1,-29,15,16,13,-29,1,18,17,-38,1,10,1,-16,33,22,1,-68,8,19,21,-18,1,14,17,-48,23,28,1,-60,1,30,41,-61,19,18,1,-22,27,22,1,-97,1,36,49,-24,19,22,1,-94,40,40,1,-76,23,42,33,-68,1,12,21,-28,35,46,25,-148,1,41,57,-55
mov $4,$0
add $0,1
mov $1,$0
mov $2,$0
sub $4,$0
lpb $1
div $0,$4
mov $3,$2
dif $3,$1
cmp $3,$2
cmp $3,0
mul $3,$1
add $0,$3
sub $1,1
lpe
add $0,1
| 28.6 | 289 | 0.58042 |
bc41ecc8ce82cc253415c6421844590f5ff76b16
| 861 |
sql
|
SQL
|
sql/sqlserver/view/system/create.view.bulletin.sql
|
ljsvn/noveltysearch
|
4dc6a5dad0f4b0f1034810d9bf5b5eb5a5d4ef9d
|
[
"Apache-2.0"
] | 2 |
2019-11-04T05:34:46.000Z
|
2020-04-17T11:13:48.000Z
|
sql/sqlserver/view/system/create.view.bulletin.sql
|
ljsvn/noveltysearch
|
4dc6a5dad0f4b0f1034810d9bf5b5eb5a5d4ef9d
|
[
"Apache-2.0"
] | null | null | null |
sql/sqlserver/view/system/create.view.bulletin.sql
|
ljsvn/noveltysearch
|
4dc6a5dad0f4b0f1034810d9bf5b5eb5a5d4ef9d
|
[
"Apache-2.0"
] | null | null | null |
-- =============================================
-- 使用刚创建的数据库
-- =============================================
use noveltysearch
go
-- =============================================
--用途:公告接收信息视图
-- 表名:v_bulletin_view_info
-- =============================================
if exists (select 1 from sysobjects where id = object_id('v_bulletin_view_info') and type = 'V')
drop view v_bulletin_view_info
go
--创建视图
create view v_bulletin_view_info as
(
select newid() as view_pk,bi.*,
br.receive_pk,br.user_name,br.user_pk,br.bulletin_isread,
br.create_org_pk as receive_org_pk,br.create_user_pk as receive_user_pk,br.delete_type as receive_delete_type,
br.create_time as receive_create_time
from t_bulletin_info bi,t_bulletin_receive br
where bi.delete_type = 0 and br.delete_type = 0
and bi.bulletin_pk = br.bulletin_pk
)
go
| 33.115385 | 112 | 0.591173 |
38aaf2877cc8ee06f225caff691383c5472ed597
| 562 |
h
|
C
|
PMMacroKeyboard/menuoptions.h
|
sgilissen/PMMacroKeyboard
|
b721d7cedfa52adcb4d0fa20b654d8ec8b5cebcc
|
[
"MIT"
] | null | null | null |
PMMacroKeyboard/menuoptions.h
|
sgilissen/PMMacroKeyboard
|
b721d7cedfa52adcb4d0fa20b654d8ec8b5cebcc
|
[
"MIT"
] | null | null | null |
PMMacroKeyboard/menuoptions.h
|
sgilissen/PMMacroKeyboard
|
b721d7cedfa52adcb4d0fa20b654d8ec8b5cebcc
|
[
"MIT"
] | null | null | null |
const static char menu_a_1[10] PROGMEM = "Ctrl+1+Alt";
const static char menu_a_2[10] PROGMEM = "Ctrl+2";
const static char menu_a_3[10] PROGMEM = "Ctrl+3";
const static char menu_a_4[10] PROGMEM = "Ctrl+4";
const char menu_a_5[10] PROGMEM = "Ctrl+5";
const char menu_a_6[10] PROGMEM = "Ctrl+6";
const char menu_a_7[10] PROGMEM = "Ctrl+7";
const char menu_a_8[10] PROGMEM = "Ctrl+8";
const char menu_a_9[10] PROGMEM = "Ctrl+9";
const char menu_a_0[10] PROGMEM = "Ctrl+0";
const char menu_a_10[10] PROGMEM = "Ctrl+*";
const char menu_a_11[10] PROGMEM = "Ctrl+`";
| 43.230769 | 54 | 0.709964 |
e8100b95a4f886ad4690cff64d8c8b7ddb31b75d
| 310 |
rs
|
Rust
|
registratur/src/v2/domain/descriptor.rs
|
akhramov/knast
|
8c9f5f481a467a22c7cc47f11a28fe52536f9950
|
[
"MIT"
] | 19 |
2021-05-16T09:41:53.000Z
|
2022-01-10T15:50:05.000Z
|
registratur/src/v2/domain/descriptor.rs
|
akhramov/knast
|
8c9f5f481a467a22c7cc47f11a28fe52536f9950
|
[
"MIT"
] | 8 |
2021-05-15T18:29:22.000Z
|
2021-09-14T09:47:39.000Z
|
registratur/src/v2/domain/descriptor.rs
|
akhramov/werft
|
8c9f5f481a467a22c7cc47f11a28fe52536f9950
|
[
"MIT"
] | 1 |
2021-09-16T00:53:36.000Z
|
2021-09-16T00:53:36.000Z
|
use serde::{Deserialize, Serialize};
/// Represents [OCI Content Descriptor](https://git.io/JvpqR)
#[derive(Serialize, Deserialize, Debug)]
pub struct Descriptor {
#[serde(rename = "mediaType")]
pub media_type: String,
pub digest: String,
pub size: usize,
pub urls: Option<Vec<String>>,
}
| 25.833333 | 61 | 0.680645 |
7a25c6e948d0cf4acbb78790d363083cc6433638
| 495 |
rb
|
Ruby
|
Task/Standard-deviation/Ruby/standard-deviation-1.rb
|
djgoku/RosettaCodeData
|
91df62d46142e921b3eacdb52b0316c39ee236bc
|
[
"Info-ZIP"
] | null | null | null |
Task/Standard-deviation/Ruby/standard-deviation-1.rb
|
djgoku/RosettaCodeData
|
91df62d46142e921b3eacdb52b0316c39ee236bc
|
[
"Info-ZIP"
] | null | null | null |
Task/Standard-deviation/Ruby/standard-deviation-1.rb
|
djgoku/RosettaCodeData
|
91df62d46142e921b3eacdb52b0316c39ee236bc
|
[
"Info-ZIP"
] | null | null | null |
class StdDevAccumulator
def initialize
@n, @sum, @sumofsquares = 0, 0.0, 0.0
end
def <<(num)
# return self to make this possible: sd << 1 << 2 << 3 # => 0.816496580927726
@n += 1
@sum += num
@sumofsquares += num**2
self
end
def stddev
Math.sqrt( (@sumofsquares / @n) - (@sum / @n)**2 )
end
def to_s
stddev.to_s
end
end
sd = StdDevAccumulator.new
i = 0
[2,4,4,4,5,5,7,9].each {|n| puts "adding #{n}: stddev of #{i+=1} samples is #{sd << n}" }
| 19.038462 | 89 | 0.557576 |
d1e5a3a9addcfee4cb1e2e4e9c47ed84a15e263f
| 145 |
sql
|
SQL
|
lsql-core/src/test/java/com/w11k/lsql/cli/StmtsWithCustomConverter.sql
|
w11k/lsql
|
9ed3459446ce9b1fbcf1b1cc931f85068d091581
|
[
"Apache-2.0"
] | 7 |
2017-04-18T09:16:09.000Z
|
2019-01-31T12:21:42.000Z
|
lsql-core/src/test/java/com/w11k/lsql/cli/StmtsWithCustomConverter.sql
|
w11k/lsql
|
9ed3459446ce9b1fbcf1b1cc931f85068d091581
|
[
"Apache-2.0"
] | 44 |
2016-03-11T11:57:32.000Z
|
2022-02-16T00:55:07.000Z
|
lsql-core/src/test/java/com/w11k/lsql/cli/StmtsWithCustomConverter.sql
|
w11k/lsql
|
9ed3459446ce9b1fbcf1b1cc931f85068d091581
|
[
"Apache-2.0"
] | 5 |
2015-12-05T10:45:49.000Z
|
2022-03-14T09:15:40.000Z
|
--load
select * from custom_converter
where field = /*: custom =*/ 1 /**/
;
--testQueryParamter
select
*
from
person1
WHERE id = /*=*/ 1 /**/;
| 11.153846 | 35 | 0.613793 |
21e49b37e69f6a0ee96a9d0ffcb772e747177156
| 412 |
kt
|
Kotlin
|
app/src/main/java/com/mityushovn/miningquiz/database/topicDao/TopicDaoAPI.kt
|
NikitaMityushov/MiningQuiz
|
3c5982454542a7e59a2cd67727ca4534bdb2187d
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/mityushovn/miningquiz/database/topicDao/TopicDaoAPI.kt
|
NikitaMityushov/MiningQuiz
|
3c5982454542a7e59a2cd67727ca4534bdb2187d
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/mityushovn/miningquiz/database/topicDao/TopicDaoAPI.kt
|
NikitaMityushov/MiningQuiz
|
3c5982454542a7e59a2cd67727ca4534bdb2187d
|
[
"MIT"
] | null | null | null |
package com.mityushovn.miningquiz.database.topicDao
import com.mityushovn.miningquiz.models.domain.Topic
import kotlinx.coroutines.flow.Flow
/**
* @author Nikita Mityushov 8.04.22
* @since 1.0
* Interface for the topic table access.
*/
interface TopicDaoAPI {
/**
* @return Flow with List of all Topic class instances.
* @see Topic
*/
suspend fun getAllTopics(): Flow<List<Topic>>
}
| 22.888889 | 59 | 0.708738 |
0bb474c96b765835d0aa72ac2a9f55772cc64886
| 650 |
js
|
JavaScript
|
doxygen/ovs_all/html/struct__OVS__USER__PACKET__QUEUE.js
|
vladn-ma/vladn-ovs-doc
|
516974aba363d3e22613fa06ce56d2b8f1b1aadf
|
[
"Apache-2.0"
] | null | null | null |
doxygen/ovs_all/html/struct__OVS__USER__PACKET__QUEUE.js
|
vladn-ma/vladn-ovs-doc
|
516974aba363d3e22613fa06ce56d2b8f1b1aadf
|
[
"Apache-2.0"
] | null | null | null |
doxygen/ovs_all/html/struct__OVS__USER__PACKET__QUEUE.js
|
vladn-ma/vladn-ovs-doc
|
516974aba363d3e22613fa06ce56d2b8f1b1aadf
|
[
"Apache-2.0"
] | null | null | null |
var struct__OVS__USER__PACKET__QUEUE =
[
[ "instance", "struct__OVS__USER__PACKET__QUEUE.html#aaa18fbd45f19c172c97d47cd5e03ba45", null ],
[ "numPackets", "struct__OVS__USER__PACKET__QUEUE.html#ac616e934fe6ca56238f46be9dcb71fa9", null ],
[ "packetList", "struct__OVS__USER__PACKET__QUEUE.html#a1cbb09f70afbfadbf3d1a8966a15ef3f", null ],
[ "pendingIrp", "struct__OVS__USER__PACKET__QUEUE.html#a71bf3dc612425549d30a3b8db1287d9f", null ],
[ "pid", "struct__OVS__USER__PACKET__QUEUE.html#a2281ff9af0db9b2428d6eab04234d20d", null ],
[ "queueLock", "struct__OVS__USER__PACKET__QUEUE.html#a06b4d0c9ff0a09ab7c3eb5cab38800dd", null ]
];
| 72.222222 | 102 | 0.804615 |
3635387696a6db32a33d2c4a13dd1f74edfcdaab
| 2,407 |
rs
|
Rust
|
tests/test_list.rs
|
alexzanderr/rust-python-objects
|
2b5a9c96a3436fbb14a41d48ab61b58b524493ae
|
[
"MIT"
] | null | null | null |
tests/test_list.rs
|
alexzanderr/rust-python-objects
|
2b5a9c96a3436fbb14a41d48ab61b58b524493ae
|
[
"MIT"
] | null | null | null |
tests/test_list.rs
|
alexzanderr/rust-python-objects
|
2b5a9c96a3436fbb14a41d48ab61b58b524493ae
|
[
"MIT"
] | null | null | null |
#![allow(
dead_code,
unused_imports,
unused_variables,
unused_macros,
unused_assignments,
unused_mut,
non_snake_case,
unused_must_use
)]
use pretty_assertions::assert_eq;
use rstest::rstest;
// crate
use python::*;
#[test]
fn test_initialization() {
let python_list = List::new();
print(type_of(&python_list));
// i know that there is not actual test
// but more things need to be implemented
// like some default traits for class list, like Copy, Debug, Eq, PartialEq ...
// in order to have assert_eq!()
}
#[test]
fn test_append_int() {
let mut python_list = List::new();
python_list.append_back(123);
python_list.append_back(123);
python_list.append_back(123);
python_list.append_back(123);
python_list.append_back(123);
print(&python_list);
let result = len(&python_list);
assert_eq!(result, 5);
// incoming
// assert_eq!(repr(&python_list), 5);
}
#[test]
fn test_append_bool() {
let mut python_list = List::new();
python_list.append_back(true);
python_list.append_back(false);
let result = len(&python_list);
assert_eq!(result, 2)
}
#[test]
fn test_extend() {
let mut python_list = List::new();
python_list.extend(123i32);
python_list.extend(List::from("from list"));
// from vec i32
python_list.extend(vec![123, 123, 123]);
let result = len(&python_list);
assert_eq!(result, 1 + "from list".len() + 3)
}
#[test]
fn test_repr() {
let mut python_list = List::new();
python_list.extend(123);
python_list.extend(123);
let result = repr(&python_list);
assert_eq!(result, "'[123, 123]'");
let mut contains_strings = List::new();
contains_strings.append_back("rust");
contains_strings.append_back("is");
contains_strings.append_back("great");
let result = repr(&contains_strings);
assert_eq!(result, "\"['rust', 'is', 'great']\"");
}
#[test]
fn test_str() {
let mut python_list = List::new();
python_list.extend(123);
python_list.extend(123);
let result = _str(&python_list);
assert_eq!(result, "[123, 123]");
let mut contains_strings = List::new();
contains_strings.append_back("rust");
contains_strings.append_back("is");
contains_strings.append_back("great");
let result = _str(&contains_strings);
assert_eq!(result, "['rust', 'is', 'great']");
}
| 22.707547 | 83 | 0.649356 |
f8c3c6390969114edfafbda877b020e6b6ce654f
| 240 |
kt
|
Kotlin
|
kotlinlib/kotlinlib/invertedFileRecurse.kt
|
JetBrains/kannotator
|
ef10885ba0a7c84a04dc33aa24dc2eb50abd622f
|
[
"Apache-2.0"
] | 23 |
2015-02-24T18:00:45.000Z
|
2021-11-08T09:49:52.000Z
|
kotlinlib/kotlinlib/invertedFileRecurse.kt
|
JetBrains/kannotator
|
ef10885ba0a7c84a04dc33aa24dc2eb50abd622f
|
[
"Apache-2.0"
] | 1 |
2015-06-29T17:03:50.000Z
|
2015-06-29T17:03:50.000Z
|
kotlinlib/kotlinlib/invertedFileRecurse.kt
|
JetBrains/kannotator
|
ef10885ba0a7c84a04dc33aa24dc2eb50abd622f
|
[
"Apache-2.0"
] | 8 |
2015-12-19T09:40:09.000Z
|
2022-03-18T16:39:05.000Z
|
package kotlinlib
import java.io.File
public fun File.invertedRecurse(block: (File) -> Unit): Unit {
if (isDirectory) {
for (child in listFiles()!!) {
child.invertedRecurse(block)
}
}
block(this)
}
| 18.461538 | 62 | 0.595833 |
5596ee935ef2200eebaa6a2cc1823c9364bc398e
| 2,160 |
kt
|
Kotlin
|
css-gg/src/commonMain/kotlin/compose/icons/cssggicons/BorderTop.kt
|
ravitejasc/compose-icons
|
09f752ef051b1c47e60554f3893bbed5ddd8bc1f
|
[
"MIT"
] | 230 |
2020-11-11T14:52:11.000Z
|
2022-03-31T05:04:52.000Z
|
css-gg/src/commonMain/kotlin/compose/icons/cssggicons/BorderTop.kt
|
ravitejasc/compose-icons
|
09f752ef051b1c47e60554f3893bbed5ddd8bc1f
|
[
"MIT"
] | 17 |
2021-03-02T00:00:32.000Z
|
2022-03-02T16:01:03.000Z
|
css-gg/src/commonMain/kotlin/compose/icons/cssggicons/BorderTop.kt
|
ravitejasc/compose-icons
|
09f752ef051b1c47e60554f3893bbed5ddd8bc1f
|
[
"MIT"
] | 18 |
2021-02-08T06:18:41.000Z
|
2022-03-22T21:48:23.000Z
|
package compose.icons.cssggicons
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.PathFillType
import androidx.compose.ui.graphics.PathFillType.Companion.NonZero
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.graphics.StrokeCap.Companion.Butt
import androidx.compose.ui.graphics.StrokeJoin
import androidx.compose.ui.graphics.StrokeJoin.Companion.Miter
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.graphics.vector.ImageVector.Builder
import androidx.compose.ui.graphics.vector.path
import androidx.compose.ui.unit.dp
import compose.icons.CssGgIcons
public val CssGgIcons.BorderTop: ImageVector
get() {
if (_borderTop != null) {
return _borderTop!!
}
_borderTop = Builder(name = "BorderTop", defaultWidth = 24.0.dp, defaultHeight = 24.0.dp,
viewportWidth = 24.0f, viewportHeight = 24.0f).apply {
path(fill = SolidColor(Color(0xFF000000)), stroke = null, fillAlpha = 0.3f,
strokeLineWidth = 0.0f, strokeLineCap = Butt, strokeLineJoin = Miter,
strokeLineMiter = 4.0f, pathFillType = NonZero) {
moveTo(8.0f, 16.0f)
horizontalLineTo(16.0f)
verticalLineTo(9.0f)
lineTo(19.0f, 9.0f)
lineTo(19.0f, 19.0f)
lineTo(5.0f, 19.0f)
lineTo(5.0f, 9.0f)
lineTo(8.0f, 9.0f)
verticalLineTo(16.0f)
close()
}
path(fill = SolidColor(Color(0xFF110000)), stroke = null, strokeLineWidth = 0.0f,
strokeLineCap = Butt, strokeLineJoin = Miter, strokeLineMiter = 4.0f,
pathFillType = NonZero) {
moveTo(5.0f, 7.0f)
lineTo(19.0f, 7.0f)
verticalLineTo(4.0f)
lineTo(5.0f, 4.0f)
lineTo(5.0f, 7.0f)
close()
}
}
.build()
return _borderTop!!
}
private var _borderTop: ImageVector? = null
| 40 | 97 | 0.611574 |
869cdee2c772390a1aadfc16aa35d7a53f38b755
| 6,704 |
rs
|
Rust
|
cli/errors.rs
|
Preta-Crowz/deno
|
2d865f7f3f4608231862610b7375ddc2e9294903
|
[
"MIT"
] | 2 |
2020-03-24T08:35:11.000Z
|
2020-12-29T21:08:12.000Z
|
cli/errors.rs
|
Preta-Crowz/deno
|
2d865f7f3f4608231862610b7375ddc2e9294903
|
[
"MIT"
] | 26 |
2021-11-22T04:24:30.000Z
|
2022-03-13T01:30:44.000Z
|
cli/errors.rs
|
Preta-Crowz/deno
|
2d865f7f3f4608231862610b7375ddc2e9294903
|
[
"MIT"
] | 1 |
2020-07-25T18:54:10.000Z
|
2020-07-25T18:54:10.000Z
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
//! There are many types of errors in Deno:
//! - AnyError: a generic wrapper that can encapsulate any type of error.
//! - JsError: a container for the error message and stack trace for exceptions
//! thrown in JavaScript code. We use this to pretty-print stack traces.
//! - Diagnostic: these are errors that originate in TypeScript's compiler.
//! They're similar to JsError, in that they have line numbers. But
//! Diagnostics are compile-time type errors, whereas JsErrors are runtime
//! exceptions.
use crate::ast::DiagnosticBuffer;
use crate::import_map::ImportMapError;
use deno_core::error::AnyError;
use deno_core::serde_json;
use deno_core::url;
use deno_core::ModuleResolutionError;
use deno_fetch::reqwest;
use rustyline::error::ReadlineError;
use std::env;
use std::error::Error;
use std::io;
fn get_dlopen_error_class(error: &dlopen::Error) -> &'static str {
use dlopen::Error::*;
match error {
NullCharacter(_) => "InvalidData",
OpeningLibraryError(ref e) => get_io_error_class(e),
SymbolGettingError(ref e) => get_io_error_class(e),
AddrNotMatchingDll(ref e) => get_io_error_class(e),
NullSymbol => "NotFound",
}
}
fn get_env_var_error_class(error: &env::VarError) -> &'static str {
use env::VarError::*;
match error {
NotPresent => "NotFound",
NotUnicode(..) => "InvalidData",
}
}
fn get_import_map_error_class(_: &ImportMapError) -> &'static str {
"URIError"
}
fn get_io_error_class(error: &io::Error) -> &'static str {
use io::ErrorKind::*;
match error.kind() {
NotFound => "NotFound",
PermissionDenied => "PermissionDenied",
ConnectionRefused => "ConnectionRefused",
ConnectionReset => "ConnectionReset",
ConnectionAborted => "ConnectionAborted",
NotConnected => "NotConnected",
AddrInUse => "AddrInUse",
AddrNotAvailable => "AddrNotAvailable",
BrokenPipe => "BrokenPipe",
AlreadyExists => "AlreadyExists",
InvalidInput => "TypeError",
InvalidData => "InvalidData",
TimedOut => "TimedOut",
Interrupted => "Interrupted",
WriteZero => "WriteZero",
UnexpectedEof => "UnexpectedEof",
Other => "Error",
WouldBlock => unreachable!(),
// Non-exhaustive enum - might add new variants
// in the future
_ => unreachable!(),
}
}
fn get_module_resolution_error_class(
_: &ModuleResolutionError,
) -> &'static str {
"URIError"
}
fn get_notify_error_class(error: ¬ify::Error) -> &'static str {
use notify::ErrorKind::*;
match error.kind {
Generic(_) => "Error",
Io(ref e) => get_io_error_class(e),
PathNotFound => "NotFound",
WatchNotFound => "NotFound",
InvalidConfig(_) => "InvalidData",
}
}
fn get_readline_error_class(error: &ReadlineError) -> &'static str {
use ReadlineError::*;
match error {
Io(err) => get_io_error_class(err),
Eof => "UnexpectedEof",
Interrupted => "Interrupted",
#[cfg(unix)]
Errno(err) => get_nix_error_class(err),
_ => unimplemented!(),
}
}
fn get_regex_error_class(error: ®ex::Error) -> &'static str {
use regex::Error::*;
match error {
Syntax(_) => "SyntaxError",
CompiledTooBig(_) => "RangeError",
_ => "Error",
}
}
fn get_request_error_class(error: &reqwest::Error) -> &'static str {
error
.source()
.and_then(|inner_err| {
(inner_err
.downcast_ref::<io::Error>()
.map(get_io_error_class))
.or_else(|| {
inner_err
.downcast_ref::<serde_json::error::Error>()
.map(get_serde_json_error_class)
})
.or_else(|| {
inner_err
.downcast_ref::<url::ParseError>()
.map(get_url_parse_error_class)
})
})
.unwrap_or("Http")
}
fn get_serde_json_error_class(
error: &serde_json::error::Error,
) -> &'static str {
use deno_core::serde_json::error::*;
match error.classify() {
Category::Io => error
.source()
.and_then(|e| e.downcast_ref::<io::Error>())
.map(get_io_error_class)
.unwrap(),
Category::Syntax => "SyntaxError",
Category::Data => "InvalidData",
Category::Eof => "UnexpectedEof",
}
}
fn get_diagnostic_class(_: &DiagnosticBuffer) -> &'static str {
"SyntaxError"
}
fn get_url_parse_error_class(_error: &url::ParseError) -> &'static str {
"URIError"
}
#[cfg(unix)]
fn get_nix_error_class(error: &nix::Error) -> &'static str {
use nix::errno::Errno::*;
match error {
nix::Error::Sys(ECHILD) => "NotFound",
nix::Error::Sys(EINVAL) => "TypeError",
nix::Error::Sys(ENOENT) => "NotFound",
nix::Error::Sys(ENOTTY) => "BadResource",
nix::Error::Sys(EPERM) => "PermissionDenied",
nix::Error::Sys(ESRCH) => "NotFound",
nix::Error::Sys(UnknownErrno) => "Error",
nix::Error::Sys(_) => "Error",
nix::Error::InvalidPath => "TypeError",
nix::Error::InvalidUtf8 => "InvalidData",
nix::Error::UnsupportedOperation => unreachable!(),
}
}
pub(crate) fn get_error_class_name(e: &AnyError) -> &'static str {
deno_core::error::get_custom_error_class(e)
.or_else(|| {
e.downcast_ref::<dlopen::Error>()
.map(get_dlopen_error_class)
})
.or_else(|| {
e.downcast_ref::<env::VarError>()
.map(get_env_var_error_class)
})
.or_else(|| {
e.downcast_ref::<ImportMapError>()
.map(get_import_map_error_class)
})
.or_else(|| e.downcast_ref::<io::Error>().map(get_io_error_class))
.or_else(|| {
e.downcast_ref::<ModuleResolutionError>()
.map(get_module_resolution_error_class)
})
.or_else(|| {
e.downcast_ref::<notify::Error>()
.map(get_notify_error_class)
})
.or_else(|| {
e.downcast_ref::<ReadlineError>()
.map(get_readline_error_class)
})
.or_else(|| {
e.downcast_ref::<reqwest::Error>()
.map(get_request_error_class)
})
.or_else(|| e.downcast_ref::<regex::Error>().map(get_regex_error_class))
.or_else(|| {
e.downcast_ref::<serde_json::error::Error>()
.map(get_serde_json_error_class)
})
.or_else(|| {
e.downcast_ref::<DiagnosticBuffer>()
.map(get_diagnostic_class)
})
.or_else(|| {
e.downcast_ref::<url::ParseError>()
.map(get_url_parse_error_class)
})
.or_else(|| {
#[cfg(unix)]
let maybe_get_nix_error_class =
|| e.downcast_ref::<nix::Error>().map(get_nix_error_class);
#[cfg(not(unix))]
let maybe_get_nix_error_class = || Option::<&'static str>::None;
(maybe_get_nix_error_class)()
})
.unwrap_or_else(|| {
panic!("Error '{}' contains boxed error of unknown type", e);
})
}
| 29.021645 | 79 | 0.638276 |
6e9cb614817f5e921ef4fb7847b9c19252230097
| 997 |
swift
|
Swift
|
Sources/SFSymbols/SwiftUI.Image+SFSymbol.swift
|
hubrioAU/SFSymbols
|
4111adf185a7a65a84bf10e76e45f52662d06d0a
|
[
"MIT"
] | 17 |
2019-06-05T00:37:52.000Z
|
2021-11-14T03:19:22.000Z
|
Sources/SFSymbols/SwiftUI.Image+SFSymbol.swift
|
HubrioAU/SFSymbols
|
4111adf185a7a65a84bf10e76e45f52662d06d0a
|
[
"MIT"
] | 1 |
2021-11-25T17:11:41.000Z
|
2021-11-25T17:11:41.000Z
|
Sources/SFSymbols/SwiftUI.Image+SFSymbol.swift
|
HubrioAU/SFSymbols
|
4111adf185a7a65a84bf10e76e45f52662d06d0a
|
[
"MIT"
] | 1 |
2021-12-26T06:44:21.000Z
|
2021-12-26T06:44:21.000Z
|
#if canImport(SwiftUI) && canImport(UIKit)
import SwiftUI
import UIKit
/**
Extension for `SwiftUI.Image` to initialize with a built-in SF Symbol.
*/
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
public extension Image {
/// Initialize a SF Symbol. Optionally you may provide symbol configuration.
init(symbol: SFSymbol, withConfiguration symbolConfiguration: UIImage.SymbolConfiguration?) {
self.init(uiImage: UIImage(symbol: symbol, withConfiguration: symbolConfiguration))
}
/// Initialize a SF Symbol with shortcuts for configuration properties.
init(symbol: SFSymbol,
pointSize: CGFloat? = nil,
symbolWeight: UIImage.SymbolWeight? = nil,
symbolScale: UIImage.SymbolScale? = nil,
textStyle: UIFont.TextStyle? = nil) {
let config: UIImage.SymbolConfiguration? = .combine(pointSize, symbolWeight, symbolScale, textStyle)
self.init(symbol: symbol, withConfiguration: config)
}
}
#endif
| 35.607143 | 108 | 0.702106 |
3ee2d6be42ccd609bfa7ca23cccf4540250d3fbb
| 1,737 |
h
|
C
|
sdk-6.5.20/libs/sdklt/bcmpkt/include/bcmpkt/flexhdr/bcmpkt_ipv6_t_defs.h
|
copslock/broadcom_cpri
|
8e2767676e26faae270cf485591902a4c50cf0c5
|
[
"Spencer-94"
] | null | null | null |
sdk-6.5.20/libs/sdklt/bcmpkt/include/bcmpkt/flexhdr/bcmpkt_ipv6_t_defs.h
|
copslock/broadcom_cpri
|
8e2767676e26faae270cf485591902a4c50cf0c5
|
[
"Spencer-94"
] | null | null | null |
sdk-6.5.20/libs/sdklt/bcmpkt/include/bcmpkt/flexhdr/bcmpkt_ipv6_t_defs.h
|
copslock/broadcom_cpri
|
8e2767676e26faae270cf485591902a4c50cf0c5
|
[
"Spencer-94"
] | null | null | null |
#ifndef BCMPKT_IPV6_T_DEFS_H
#define BCMPKT_IPV6_T_DEFS_H
/*****************************************************************
*
* DO NOT EDIT THIS FILE!
* This file is auto-generated by xfc_map_parser
* from the NPL output file(s) header.yml.
* Edits to this file will be lost when it is regenerated.
*
*
* This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
*
* Copyright 2007-2020 Broadcom Inc. All rights reserved.
* All Rights Reserved.$
*
* Tool Path: $SDK/INTERNAL/fltg/xfc_map_parser
*/
/*!
* \name IPV6_T field IDs.
* \anchor BCMPKT_IPV6_T_XXX
*/
#define BCMPKT_IPV6_T_PAYLOAD_LENGTH 0
#define BCMPKT_IPV6_T_TRAFFIC_CLASS 1
#define BCMPKT_IPV6_T_DA 2
#define BCMPKT_IPV6_T_VERSION 3
#define BCMPKT_IPV6_T_FLOW_LABEL 4
#define BCMPKT_IPV6_T_HOP_LIMIT 5
#define BCMPKT_IPV6_T_NEXT_HEADER 6
#define BCMPKT_IPV6_T_SA 7
#define BCMPKT_IPV6_T_FID_INVALID -1
#define BCMPKT_IPV6_T_FID_COUNT 8
#define BCMPKT_IPV6_T_FID_START 0
#define BCMPKT_IPV6_T_FID_END (BCMPKT_IPV6_T_FID_COUNT - 1)
#define BCMPKT_IPV6_T_I_SUPPORT 0
#define BCMPKT_IPV6_T_I_FID_COUNT 1
#define BCMPKT_IPV6_T_FIELD_NAME_MAP_INIT \
{"PAYLOAD_LENGTH", BCMPKT_IPV6_T_PAYLOAD_LENGTH},\
{"TRAFFIC_CLASS", BCMPKT_IPV6_T_TRAFFIC_CLASS},\
{"DA", BCMPKT_IPV6_T_DA},\
{"VERSION", BCMPKT_IPV6_T_VERSION},\
{"FLOW_LABEL", BCMPKT_IPV6_T_FLOW_LABEL},\
{"HOP_LIMIT", BCMPKT_IPV6_T_HOP_LIMIT},\
{"NEXT_HEADER", BCMPKT_IPV6_T_NEXT_HEADER},\
{"SA", BCMPKT_IPV6_T_SA},\
{"ipv6_t fid count", BCMPKT_IPV6_T_FID_COUNT}
#endif /* BCMPKT_IPV6_T_DEFS_H */
| 33.403846 | 134 | 0.703512 |
836de536b0d9d34657ffb927bf621811690b5fb5
| 31 |
rs
|
Rust
|
core/test/step/mod.rs
|
clearlycloudy/e2
|
25b63e0f3426112a6ac6546168aea38a061dc33f
|
[
"BSD-2-Clause"
] | 4 |
2018-01-15T14:22:11.000Z
|
2019-11-16T21:20:44.000Z
|
core/test/step/mod.rs
|
clearlycloudy/e2
|
25b63e0f3426112a6ac6546168aea38a061dc33f
|
[
"BSD-2-Clause"
] | 1 |
2018-02-28T11:37:49.000Z
|
2018-02-28T11:37:49.000Z
|
core/test/step/mod.rs
|
clearlycloudy/e2r
|
25b63e0f3426112a6ac6546168aea38a061dc33f
|
[
"BSD-2-Clause"
] | null | null | null |
pub mod test_step_interpolate;
| 15.5 | 30 | 0.870968 |
9c06a6731ebaf074308c55dcd8af0200cdf4540c
| 794 |
js
|
JavaScript
|
src/pages/index.js
|
yoon7ks/yoon7ks.github.io
|
ea471b80e99a5ecab7e8b898e440bfc59c16cb97
|
[
"MIT"
] | null | null | null |
src/pages/index.js
|
yoon7ks/yoon7ks.github.io
|
ea471b80e99a5ecab7e8b898e440bfc59c16cb97
|
[
"MIT"
] | 3 |
2021-05-10T16:58:31.000Z
|
2022-02-18T12:40:31.000Z
|
src/pages/index.js
|
yoon7ks/yoon7ks.github.io
|
ea471b80e99a5ecab7e8b898e440bfc59c16cb97
|
[
"MIT"
] | null | null | null |
import React from "react"
import Layout from "../component/layout"
import { graphql } from "gatsby"
const IndexPage = ({ data }) => (
<Layout>
<p>하루하루 감사하며 행복한 둥고</p>
<h3>포스트 목록</h3>
{data.allMarkdownRemark.edges.map(post => (
<div>
<a
key={post.node.id}
href={post.node.frontmatter.path}>
{post.node.frontmatter.title}
</a>
<p>{post.node.frontmatter.date}</p>
</div>
))}
</Layout>
)
export const pageQuery = graphql`
query IndexQuery {
allMarkdownRemark {
edges {
node {
id
frontmatter {
title
date
path
}
}
}
}
}
`
export default IndexPage
| 19.85 | 50 | 0.471033 |
f01d111acc2f82bd1f1d2cbac6154bff055a65f9
| 2,652 |
js
|
JavaScript
|
node_modules/cypress-ntlm-auth/dist/launchers/ntlm.proxy.main.js
|
yuosha/TestAutomationWithCypress
|
b6ebb73527a816beebec35a709c308aca6303069
|
[
"MIT"
] | null | null | null |
node_modules/cypress-ntlm-auth/dist/launchers/ntlm.proxy.main.js
|
yuosha/TestAutomationWithCypress
|
b6ebb73527a816beebec35a709c308aca6303069
|
[
"MIT"
] | null | null | null |
node_modules/cypress-ntlm-auth/dist/launchers/ntlm.proxy.main.js
|
yuosha/TestAutomationWithCypress
|
b6ebb73527a816beebec35a709c308aca6303069
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env node
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const dependency_injection_1 = require("../proxy/dependency.injection");
const dependency_injection_types_1 = require("../proxy/dependency.injection.types");
const node_cleanup_1 = __importDefault(require("node-cleanup"));
const container = new dependency_injection_1.DependencyInjection();
let proxyMain = container.get(dependency_injection_types_1.TYPES.IMain);
let debug = container.get(dependency_injection_types_1.TYPES.IDebugLogger);
const upstreamProxyConfigurator = container.get(dependency_injection_types_1.TYPES.IUpstreamProxyConfigurator);
upstreamProxyConfigurator.processNoProxyLoopback();
(() => __awaiter(void 0, void 0, void 0, function* () {
yield proxyMain.run(false, process.env.HTTP_PROXY, process.env.HTTPS_PROXY, process.env.NO_PROXY);
}))();
// Unfortunately we can only catch these signals on Mac/Linux,
// Windows gets a hard exit => the portsFile is left behind,
// but will be replaced on next start
node_cleanup_1.default((exitCode, signal) => {
if (exitCode) {
debug.log("Detected process exit with code", exitCode);
// On a non-signal exit, we cannot postpone the process termination.
// We try to cleanup but cannot be sure that the ports file was deleted.
proxyMain.stop();
}
if (signal) {
debug.log("Detected termination signal", signal);
// On signal exit, we postpone the process termination by returning false,
// to ensure that cleanup has completed.
(() => __awaiter(void 0, void 0, void 0, function* () {
yield proxyMain.stop();
process.kill(process.pid, signal);
}))();
node_cleanup_1.default.uninstall(); // don't call cleanup handler again
return false;
}
});
| 54.122449 | 118 | 0.687029 |
a8bf88c792a5370027814c6ebb12fe2485e0eb1b
| 1,346 |
rs
|
Rust
|
tests/test.rs
|
usagi/gsj
|
46e13d9c0b9c3a40c02878e16451a604a16b74b4
|
[
"MIT"
] | 1 |
2020-09-12T01:09:52.000Z
|
2020-09-12T01:09:52.000Z
|
tests/test.rs
|
usagi/gsj
|
46e13d9c0b9c3a40c02878e16451a604a16b74b4
|
[
"MIT"
] | null | null | null |
tests/test.rs
|
usagi/gsj
|
46e13d9c0b9c3a40c02878e16451a604a16b74b4
|
[
"MIT"
] | null | null | null |
const GSI_DEM_PNG_SCALING_FACTOR: f64 = 1.0e-2;
#[test]
fn decode()
{
let from_png = load_png();
let from_txt = load_txt();
let pairs = from_png.iter().zip(from_txt.iter());
for (actual, expected) in pairs
{
assert_eq!(actual.is_nan(), expected.is_nan());
if !actual.is_nan()
{
assert_eq!(actual.round(), expected.round());
}
}
}
#[test]
fn encode()
{
let from_txt = load_txt();
let encoded = gsj::altitude_tile::nishioka_nagatsu_2015::encode(&from_txt, 256, GSI_DEM_PNG_SCALING_FACTOR);
let decoded = gsj::altitude_tile::nishioka_nagatsu_2015::decode(&encoded, GSI_DEM_PNG_SCALING_FACTOR);
for (actual, expected) in decoded.iter().zip(decoded.iter())
{
assert_eq!(actual.is_nan(), expected.is_nan());
if !actual.is_nan()
{
assert_eq!(actual.round(), expected.round());
}
}
}
fn load_png() -> Vec<f64>
{
let png = image::open("tests/gsi-dem-z8-x229-y94.png").unwrap();
gsj::altitude_tile::nishioka_nagatsu_2015::decode(&png, GSI_DEM_PNG_SCALING_FACTOR)
}
fn load_txt() -> Vec<f64>
{
let from_text = std::fs::read_to_string("tests/gsi-dem-z8-x229-y94.txt").unwrap();
let from_text = from_text
.lines()
.map(|line| line.split(","))
.flatten()
.map(|t| {
let f_maybe = t.parse::<f64>();
match f_maybe
{
Ok(f) => f,
_ => std::f64::NAN
}
})
.collect::<Vec<_>>();
from_text
}
| 22.433333 | 109 | 0.659733 |
9c1eeb4dda8cfacb60430120611ad230055397b2
| 16,814 |
kt
|
Kotlin
|
api/src/main/java/com/brein/domain/BreinUser.kt
|
Breinify/brein-api-library-android-kotlin
|
055e20c35ffb722aa6c3dc78f7092106571cdd42
|
[
"MIT"
] | null | null | null |
api/src/main/java/com/brein/domain/BreinUser.kt
|
Breinify/brein-api-library-android-kotlin
|
055e20c35ffb722aa6c3dc78f7092106571cdd42
|
[
"MIT"
] | null | null | null |
api/src/main/java/com/brein/domain/BreinUser.kt
|
Breinify/brein-api-library-android-kotlin
|
055e20c35ffb722aa6c3dc78f7092106571cdd42
|
[
"MIT"
] | null | null | null |
package com.brein.domain
import android.Manifest
import android.app.Application
import android.content.Context
import android.content.Context.WIFI_SERVICE
import android.content.pm.PackageManager
import android.location.Location
import android.location.LocationManager
import android.net.wifi.SupplicantState
import android.net.wifi.WifiInfo
import android.net.wifi.WifiManager
import android.util.Log
import androidx.core.app.ActivityCompat
import com.brein.api.Breinify
import com.brein.api.BreinifyManager
import com.brein.util.BreinUtil
import com.google.gson.JsonObject
import java.math.BigInteger
import java.net.InetAddress
import java.net.UnknownHostException
import java.nio.ByteOrder
/**
* A plain object specifying the user information the activity belongs to
*
* create a brein user with field email.
*
* @param email of the user
*/
class BreinUser(private var email: String?) {
enum class UserInfo {
FIRST_NAME,
LAST_NAME,
PHONE_NUMBER,
EMAIL
}
/**
* contains further fields in the user section
*/
private val userMap = HashMap<String, Any?>()
/**
* contains further fields in the user additional section
*/
private val additionalMap = HashMap<String, Any?>()
/**
* contains the first name of the user
*
* @return String the first name
*/
private var firstName: String = ""
/**
* contains the last name of the user
*
* @return last name
*/
private var lastName: String = ""
/**
* contains the sessionId (if set)
*
* @return sessionId
*/
private var sessionId: String = ""
/**
* contains the date of birth
*
* @return String, date of birth
*/
private var dateOfBirth: String = ""
fun setDateOfBirth(dateOfBirth: String): BreinUser {
this.dateOfBirth = dateOfBirth
this.userMap["dateOfBirth"] = this.dateOfBirth
return this
}
fun getDateOfBirth(): String {
return this.dateOfBirth
}
/**
* Set's the date of birth
* There is no check if the month - day combination is valid, only
* the range for day, month and year will be checked
*
* @param month int month (1..12)
* @param day int day (1..31)
* @param year int year (1900..2100)
* @return BreinUser the object itself
*/
fun setDateOfBirthValue(month: Int, day: Int, year: Int): BreinUser {
if (month in 1..12 &&
day in 1..31 &&
year in 1900..2100
) {
this.dateOfBirth = String.format("%s/%d/%d", month, day, year)
this.userMap["dateOfBirth"] = this.dateOfBirth
} else {
this.dateOfBirth = ""
this.userMap["dateOfBirth"] = this.dateOfBirth
}
return this
}
/**
* contains imei (International Mobile Equipment Identity)
*
* @return String serial number as string
*/
private var imei: String = ""
/**
* contains the deviceid
*
* @return String device id
*/
private var deviceId: String = ""
/**
* contains the userId
*
* @return String userId String
*/
private var userId: String = ""
fun setUserId(s: String): BreinUser {
this.userId = s
this.userMap["userId"] = this.userId
return this
}
/**
* contains the phone number
*
* @return String phone number
*/
private var phone: String = ""
/**
* retrieves the additional userAgent value
*
* @return String user agent
*/
private var userAgent: String = ""
/**
* contains the ipAddress (additional part)
*
* @return String ipAddress
*/
private var ipAddress: String = ""
fun getIpAddress(): String {
return this.ipAddress
}
/**
* contains the detected ipAddress (additional part)
*
* @return String detected ipAddress
*/
private var detectedIp: String = ""
fun getDetectedIp(): String {
return this.detectedIp
}
/**
* contains the additional referrer value
*
* @return String the referrer
*/
private var referrer: String = ""
/**
* contains the timezone
*
* @return String contains the timezone
*/
private var timezone: String = ""
fun getTimezone(): String {
return this.timezone
}
/**
* contains the additional url
*
* @return String the url
*/
private var url: String = ""
fun getUrl(): String {
return this.url
}
/**
* contains the localDateTime
*
* @return String the local date time
*/
private var localDateTime: String = ""
fun getLocalDateTime(): String {
return this.localDateTime
}
/**
* retrieves the pushDeviceToken
*
* @return String the deviceRegistration token
*/
private var pushDeviceRegistration: String = ""
fun getPushDeviceRegistration(): String {
return this.pushDeviceRegistration
}
fun setEmail(e: String): BreinUser {
this.email = e
this.userMap["email"] = this.email
return this
}
fun setIpAddress(s: String): BreinUser {
this.ipAddress = s
this.additionalMap["ipAddress"] = this.ipAddress
return this
}
fun setDetectedIp(s: String): BreinUser {
this.detectedIp = s
this.additionalMap["detectedIp"] = this.detectedIp
return this
}
fun setUserAgent(s: String): BreinUser {
this.userAgent = s
this.additionalMap["userAgent"] = this.userAgent
return this
}
fun setDeviceId(s: String): BreinUser {
this.deviceId = s
this.userMap["deviceId"] = this.deviceId
return this
}
fun getDeviceId(): String {
return this.deviceId
}
fun setImei(s: String): BreinUser {
this.imei = s
this.userMap["imei"] = this.imei
return this
}
fun setSessionId(s: String): BreinUser {
this.sessionId = s
this.userMap["sessionId"] = this.sessionId
return this
}
fun getSessionId(): String {
return this.sessionId
}
fun setUrl(s: String): BreinUser {
this.url = s
this.additionalMap["url"] = this.url
return this
}
fun setReferrer(s: String): BreinUser {
this.referrer = s
this.additionalMap["referrer"] = this.referrer
return this
}
fun getReferrer(): String {
return this.referrer
}
fun setLastName(s: String): BreinUser {
this.lastName = s
this.userMap["lastName"] = this.lastName
return this
}
fun getLastName(): String {
return this.lastName
}
fun setFirstName(s: String): BreinUser {
this.firstName = s
this.userMap["firstName"] = this.firstName
return this
}
fun getFirstName(): String {
return this.firstName
}
fun setTimezone(timezone: String): BreinUser {
this.timezone = timezone
this.additionalMap["timezone"] = this.timezone
return this
}
fun setLocalDateTime(localDateTime: String): BreinUser {
this.localDateTime = localDateTime
this.additionalMap["localDateTime"] = this.localDateTime
return this
}
fun setPushDeviceRegistration(deviceToken: String?): BreinUser {
if (deviceToken != null) {
this.pushDeviceRegistration = deviceToken
val identifierMap = HashMap<String, Any?>()
identifierMap["androidPushDeviceRegistration"] = this.pushDeviceRegistration
this.additionalMap["identifiers"] = identifierMap
}
return this
}
fun resetDateOfBirth(): BreinUser {
this.dateOfBirth = ""
return this
}
fun setPhone(phone: String): BreinUser {
this.phone = phone
this.userMap["phone"] = this.phone
return this
}
constructor() : this("") {
}
/**
* Creates the userAgent String in Android standard format and adds the
* app name.
*
* @return String userAgent
*/
private fun createUserAgent(): String {
val appCtx: Application? = BreinifyManager.getApplication()
var appName = ""
if (appCtx != null) {
appName = appCtx.applicationInfo.loadLabel(appCtx.packageManager).toString()
}
// add the app
val httpAgent = System.getProperty("http.agent")
return if (httpAgent != null) {
String.format("%s/(%s)", httpAgent, appName)
} else {
""
}
}
/**
* detects the GPS coordinates and adds this to the user.additional.location section
*/
private fun detectGpsCoordinates() {
// firstly get the context
val applicationContext: Application = Breinify.config?.getApplication() ?: return
val locationManager: LocationManager =
applicationContext.getSystemService(Context.LOCATION_SERVICE) as LocationManager
val providers: List<String> = locationManager.allProviders // getProviders(true);
// Loop over the array backwards, and if you get an accurate location, then break out the loop
val location: Location? = null
for (index in providers.indices.reversed()) {
val accessFineLocationPermission: Int = ActivityCompat.checkSelfPermission(
applicationContext,
Manifest.permission.ACCESS_FINE_LOCATION
)
val accessCoarseLocationPermission: Int = ActivityCompat.checkSelfPermission(
applicationContext,
Manifest.permission.ACCESS_COARSE_LOCATION
)
if (accessCoarseLocationPermission != PackageManager.PERMISSION_GRANTED ||
accessFineLocationPermission != PackageManager.PERMISSION_GRANTED
) {
return
}
}
if (location != null) {
val locationData = JsonObject()
locationData.addProperty("accuracy", location.accuracy)
locationData.addProperty("speed", location.speed)
locationData.addProperty("latitude", location.latitude)
locationData.addProperty("longitude", location.longitude)
this.additionalMap["location"] = locationData
}
}
/**
* Provides network information within the user additional request
*/
private fun detectNetwork() {
// firstly get the context
val applicationContext: Application = Breinify.config?.getApplication() ?: return
// only possible if permission has been granted
if (ActivityCompat.checkSelfPermission(
applicationContext,
Manifest.permission.ACCESS_WIFI_STATE
) == PackageManager.PERMISSION_GRANTED
) {
val wifiManager: WifiManager = applicationContext
.applicationContext
.getSystemService(WIFI_SERVICE) as WifiManager
val wifiInfo: WifiInfo = wifiManager.connectionInfo
val wifiInfoStatus = wifiInfo.supplicantState
if (wifiInfoStatus == SupplicantState.COMPLETED) {
var ssid = ""
var bssid = ""
var ip = 0
// contains double quotes
wifiInfo.ssid?.let { ssid = wifiInfo.ssid.replace("\"", "") }
wifiInfo.bssid?.let { bssid = wifiInfo.bssid }
wifiInfo.ipAddress.let { ip = wifiInfo.ipAddress }
// Convert little-endian to big-endian if needed
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
ip = Integer.reverseBytes(ip)
}
val detectedIpAddress = try {
val ipByteArray: ByteArray = BigInteger.valueOf(ip.toLong()).toByteArray()
InetAddress.getByAddress(ipByteArray).hostAddress
} catch (ex: UnknownHostException) {
Log.e("WIFIIP", "Breinify - unable to get host address.")
null
}
if (detectedIpAddress != null) {
if (detectedIpAddress.isNotEmpty()) {
setDetectedIp(detectedIpAddress)
}
}
val linkSpeed: Int = wifiInfo.linkSpeed
val macAddress = ""
val rssi: Int = wifiInfo.rssi
val networkId: Int = wifiInfo.networkId
val state: String = wifiInfo.supplicantState.toString()
val networkData = JsonObject()
networkData.addProperty("ssid", ssid)
networkData.addProperty("bssid", bssid)
networkData.addProperty("ipAddress", this.ipAddress)
networkData.addProperty("linkSpeed", linkSpeed)
networkData.addProperty("macAddress", macAddress)
networkData.addProperty("rssi", rssi)
networkData.addProperty("networkId", networkId)
networkData.addProperty("state", state)
this.additionalMap["network"] = networkData
}
}
}
/**
* Sets the users value and overrides any current value. Cannot used to override the `additional` field.
*
* @param key String the name of the value to be set
* @param value Object the value to be set
* @return BreinUser the object itself
*/
operator fun set(key: String, value: Any?, additional: Boolean): BreinUser {
if (additional) {
this.additionalMap[key] = value
} else {
this.userMap[key] = value
}
return this
}
/**
* Retrieves for a given key the object
* @param key String, contains the key
* @param <T> T contains the object
* @return T contains the object
</T> */
operator fun get(key: String): Any? {
return get(key, false)
}
/**
* Retrieves for a given key within the additional or userMap the value
*
* @param key String, contains the key
* @param additional boolean true if additional part should be used
* @param <T> T contains the value
* @return T contains the value
</T> */
operator fun get(key: String, additional: Boolean): Any? {
return if (additional) {
this.additionalMap[key]
} else {
this.userMap[key]
}
}
/**
* Retrieves the additional value
*
* @param key String contains the key
* @param <T> T contains the value
* @return T contains the value
</T> */
fun getAdditional(key: String): Any? {
return get(key, true)
}
/**
* Sets an additional value.
*
* @param key String, the name of the additional value to be set
* @param value Object the value to be set
* @return BreinUser the object itself
*/
fun setAdditional(key: String, value: Any?): BreinUser {
this.additionalMap[key] = value
return this
}
/**
* prepares the request data
*
* @param config BreinConfig, contains the configuration (if necessary)
* @param requestData Map request destination
*/
@Suppress("UNUSED_PARAMETER")
fun prepareRequestData(config: BreinConfig?, requestData: HashMap<String, Any?>) {
val userRequestData = HashMap<String, Any?>()
requestData["user"] = userRequestData
// add the user-data, if there is any
if (this.userMap.isNotEmpty()) {
// loop a Map
for ((key, value) in this.userMap) {
if (BreinUtil.containsValue(value)) {
userRequestData[key] = value
}
}
}
// tries to detect gps and network data this will be added to property additionalMap
detectGpsCoordinates()
detectNetwork()
// check or create userAgent
generateUserAgent()
// add the additional-data, if there is any
if (this.additionalMap.isNotEmpty()) {
userRequestData["additional"] = this.additionalMap
}
}
/**
* Checks if a userAgent has been set if not it will be generated and set.
*/
private fun generateUserAgent() {
if (this.userAgent.isEmpty()) {
this.userAgent = createUserAgent()
}
if (this.userAgent.isNotEmpty()) {
this.additionalMap["userAgent"] = this.userAgent
}
}
}
| 28.498305 | 108 | 0.587665 |
229b101c25d73004857189502ff207cdcd9281c3
| 1,612 |
html
|
HTML
|
data/projects/dotnet-compiler-platform.html
|
miwebst/temppagesclone
|
a9375db212565ce2da67a4a886cc0779fe6ccb6f
|
[
"MIT"
] | null | null | null |
data/projects/dotnet-compiler-platform.html
|
miwebst/temppagesclone
|
a9375db212565ce2da67a4a886cc0779fe6ccb6f
|
[
"MIT"
] | null | null | null |
data/projects/dotnet-compiler-platform.html
|
miwebst/temppagesclone
|
a9375db212565ce2da67a4a886cc0779fe6ccb6f
|
[
"MIT"
] | null | null | null |
<h1 id="net-compiler-platform-roslyn">.NET Compiler Platform ("Roslyn")</h1>
<p>The <a href="https://github.com/dotnet/roslyn">.NET Compiler Platform ("Roslyn")</a> provides open-source C# and Visual Basic compilers with rich code analysis APIs. You can build code analysis tools with the same APIs that Microsoft is using to implement Visual Studio!</p>
<h2 id="project-details">Project Details</h2>
<ul>
<li><a href="https://github.com/dotnet/roslyn/wiki/Roslyn%20Overview">Project Info Site</a></li>
<li><a href="https://github.com/dotnet/roslyn">Project Code Site</a></li>
<li>Project Docs Repos: <a href="https://github.com/dotnet/docs">Concepts</a>, <a href="https://github.com/dotnet/roslyn-api-docs">APIs</a></li>
<li>Project License Type: <a href="https://github.com/dotnet/roslyn/blob/master/License.txt">Apache License 2.0</a></li>
<li>Project Main Contact: <a href="https://github.com/Pilchie">Kevin Pilch-Bisson</a></li>
</ul>
<h2 id="quicklinks">Quicklinks</h2>
<ul>
<li><a href="https://roslyn.codeplex.com/wikipage?title=How%20to%20Contribute">Contribute</a></li>
<li><a href="https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/">Documentation</a></li>
<li><a href="https://jabbr.net/#/rooms/roslyn">Jabbr</a></li>
<li><a href="https://roslyn.codeplex.com/wikipage?title=Questions%2c%20Comments%2c%20and%20Feedback&referringTitle=Home">Questions, Comments and Feedback</a></li>
</ul>
<p>Blogs:</p>
<ul>
<li><a href="https://blogs.msdn.com/b/vbteam/archive/tags/roslyn/">VB</a></li>
<li><a href="https://blogs.msdn.com/b/csharpfaq/archive/tags/roslyn/">C#</a></li>
</ul>
| 70.086957 | 287 | 0.719603 |
9ce2459aca52f4503ac31420ab1625efb9380270
| 1,423 |
css
|
CSS
|
public/css/footer.css
|
NicoFlecha/ecommerce-laravel-5.8
|
46372c84396bdd359b235bd3f930ce7ad0fa9efb
|
[
"MIT"
] | 1 |
2021-04-13T21:56:52.000Z
|
2021-04-13T21:56:52.000Z
|
public/css/footer.css
|
NicoFlecha/ecommerce-laravel-5.8
|
46372c84396bdd359b235bd3f930ce7ad0fa9efb
|
[
"MIT"
] | 2 |
2021-06-28T17:28:51.000Z
|
2021-06-28T18:48:30.000Z
|
public/css/footer.css
|
NicoFlecha/ecommerce-laravel-5.8
|
46372c84396bdd359b235bd3f930ce7ad0fa9efb
|
[
"MIT"
] | null | null | null |
footer {
color: white;
background-attachment: fixed;
background-color:#E47F6B;
background-size: cover;
background-position: bottom;
margin-top: 30px;
}
footer p {
color: white;
}
footer a {
color: white;
}
.social-pet li {
display: inline-block;
margin-right: 10px;
}
.social-pet li a {
height: 35px;
width: 35px;
border-radius: 50%;
text-align: center;
display: block;
line-height: 35px;
background-color: #3a5a95;
color: #fff;
}
.social-pet li:nth-child(2) a {
background-color: #57aced;
color: #fff;
}
.social-pet li:nth-child(3) a {
background-color: #21A0E0;
color: #fff;
}
.social-pet li:nth-child(4) a {
background-color: #6b27b2;
color: #fff;
}
.social-pet li a:hover {
background-color: #0141a2;
color: #fff;
}
.social-pet li a:hover i {
transform: rotate(360deg);
-moz-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
}
footer .input-group-addon {
background-color: #0141a2;
padding: 10px 10px 2px 10px;
border-radius: 0 5px 5px 0;
color: white;
}
.f-address li {
display: inline-block;
}
.f-address li i {
color: white;
font-size: 18px;
}
.f-address li a {
color: white;
}
.legales i{
color: orange;
}
.copyright {
background-color: #111;
padding: 12px 0;
font-size:14px;
}
| 19.22973 | 38 | 0.59241 |
fdbd38f86b980dedea3902fd774062733fffc115
| 5,560 |
sql
|
SQL
|
sql/yjbb/601595.sql
|
liangzi4000/grab-share-info
|
4dc632442d240c71955bbf927ecf276d570a2292
|
[
"MIT"
] | null | null | null |
sql/yjbb/601595.sql
|
liangzi4000/grab-share-info
|
4dc632442d240c71955bbf927ecf276d570a2292
|
[
"MIT"
] | null | null | null |
sql/yjbb/601595.sql
|
liangzi4000/grab-share-info
|
4dc632442d240c71955bbf927ecf276d570a2292
|
[
"MIT"
] | null | null | null |
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2017-09-30',@EPS = N'0.41',@EPSDeduct = N'0',@Revenue = N'8.21亿',@RevenueYoy = N'8.82',@RevenueQoq = N'6.82',@Profit = N'1.54亿',@ProfitYoy = N'-13.26',@ProfiltQoq = N'-19.47',@NAVPerUnit = N'5.3293',@ROE = N'7.85',@CashPerUnit = N'0.4734',@GrossProfitRate = N'27.58',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-31'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2017-06-30',@EPS = N'0.29',@EPSDeduct = N'0.25',@Revenue = N'5.27亿',@RevenueYoy = N'6.07',@RevenueQoq = N'9.10',@Profit = N'1.07亿',@ProfitYoy = N'-13.10',@ProfiltQoq = N'24.11',@NAVPerUnit = N'5.2019',@ROE = N'5.42',@CashPerUnit = N'0.3167',@GrossProfitRate = N'27.53',@Distribution = N'不分配不转增',@DividenRate = N'-',@AnnounceDate = N'2017-08-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2017-03-31',@EPS = N'0.13',@EPSDeduct = N'0',@Revenue = N'2.52亿',@RevenueYoy = N'-7.90',@RevenueQoq = N'-13.34',@Profit = N'4762.09万',@ProfitYoy = N'-26.88',@ProfiltQoq = N'-18.42',@NAVPerUnit = N'5.2937',@ROE = N'2.44',@CashPerUnit = N'0.2030',@GrossProfitRate = N'26.82',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2016-06-30',@EPS = N'0.44',@EPSDeduct = N'0.41',@Revenue = N'4.97亿',@RevenueYoy = N'18.15',@RevenueQoq = N'-18.43',@Profit = N'1.23亿',@ProfitYoy = N'21.89',@ProfiltQoq = N'-11.43',@NAVPerUnit = N'3.4777',@ROE = N'14.60',@CashPerUnit = N'0.4389',@GrossProfitRate = N'33.67',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-08-23'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2016-03-31',@EPS = N'0.23',@EPSDeduct = N'0',@Revenue = N'2.74亿',@RevenueYoy = N'-',@RevenueQoq = N'6.02',@Profit = N'6512.60万',@ProfitYoy = N'-',@ProfiltQoq = N'40.70',@NAVPerUnit = N'0.0000',@ROE = N'8.00',@CashPerUnit = N'0.0000',@GrossProfitRate = N'36.45',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2016-12-31',@EPS = N'0.75',@EPSDeduct = N'0.64',@Revenue = N'10.46亿',@RevenueYoy = N'16.17',@RevenueQoq = N'13.02',@Profit = N'2.36亿',@ProfitYoy = N'22.57',@ProfiltQoq = N'5.94',@NAVPerUnit = N'5.1662',@ROE = N'19.62',@CashPerUnit = N'0.5117',@GrossProfitRate = N'31.21',@Distribution = N'10派2.5',@DividenRate = N'1.01',@AnnounceDate = N'2017-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2015-09-30',@EPS = N'0.52',@EPSDeduct = N'0',@Revenue = N'6.42亿',@RevenueYoy = N'-',@RevenueQoq = N'-',@Profit = N'1.46亿',@ProfitYoy = N'-',@ProfiltQoq = N'-',@NAVPerUnit = N'0.0000',@ROE = N'22.53',@CashPerUnit = N'0.0000',@GrossProfitRate = N'38.34',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-10-26'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2015-06-30',@EPS = N'0.36',@EPSDeduct = N'0.33',@Revenue = N'4.21亿',@RevenueYoy = N'-',@RevenueQoq = N'-',@Profit = N'1.01亿',@ProfitYoy = N'-',@ProfiltQoq = N'-',@NAVPerUnit = N'0.0000',@ROE = N'15.82',@CashPerUnit = N'0.6500',@GrossProfitRate = N'39.13',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-08-16'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2014-12-31',@EPS = N'0.58',@EPSDeduct = N'0.48',@Revenue = N'7.03亿',@RevenueYoy = N'18.28',@RevenueQoq = N'-',@Profit = N'1.61亿',@ProfitYoy = N'15.07',@ProfiltQoq = N'-',@NAVPerUnit = N'2.1164',@ROE = N'30.44',@CashPerUnit = N'0.8824',@GrossProfitRate = N'37.45',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-07-27'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2013-12-31',@EPS = N'0.5',@EPSDeduct = N'0.45',@Revenue = N'5.94亿',@RevenueYoy = N'22.56',@RevenueQoq = N'-',@Profit = N'1.40亿',@ProfitYoy = N'33.91',@ProfiltQoq = N'-',@NAVPerUnit = N'1.6664',@ROE = N'34.75',@CashPerUnit = N'0.5984',@GrossProfitRate = N'39.09',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2016-07-27'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2012-12-31',@EPS = N'0.37',@EPSDeduct = N'0.27',@Revenue = N'4.85亿',@RevenueYoy = N'17.06',@RevenueQoq = N'-',@Profit = N'1.05亿',@ProfitYoy = N'23.34',@ProfiltQoq = N'-',@NAVPerUnit = N'1.2269',@ROE = N'30.86',@CashPerUnit = N'0.3090',@GrossProfitRate = N'40.49',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2015-06-29'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2016-09-30',@EPS = N'0.6',@EPSDeduct = N'0',@Revenue = N'7.55亿',@RevenueYoy = N'17.57',@RevenueQoq = N'15.29',@Profit = N'1.78亿',@ProfitYoy = N'21.45',@ProfiltQoq = N'-4.48',@NAVPerUnit = N'4.9978',@ROE = N'17.53',@CashPerUnit = N'0.4053',@GrossProfitRate = N'33.60',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-10-31'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2015-12-31',@EPS = N'0.69',@EPSDeduct = N'0.61',@Revenue = N'9.00亿',@RevenueYoy = N'28.06',@RevenueQoq = N'16.81',@Profit = N'1.93亿',@ProfitYoy = N'19.44',@ProfiltQoq = N'1.21',@NAVPerUnit = N'2.7907',@ROE = N'28.86',@CashPerUnit = N'1.1042',@GrossProfitRate = N'35.37',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2017-04-25'
EXEC [EST].[Proc_yjbb_Ins] @Code = N'601595',@CutoffDate = N'2011-12-31',@EPS = N'0',@EPSDeduct = N'0',@Revenue = N'4.14亿',@RevenueYoy = N'-',@RevenueQoq = N'-',@Profit = N'8492.61万',@ProfitYoy = N'-',@ProfiltQoq = N'-',@NAVPerUnit = N'39.0566',@ROE = N'26.93',@CashPerUnit = N'15.4087',@GrossProfitRate = N'42.51',@Distribution = N'-',@DividenRate = N'-',@AnnounceDate = N'2014-04-18'
| 397.142857 | 410 | 0.63723 |
5838e61bc9c42bd6426db3340d631d0484f94391
| 233 |
h
|
C
|
src/SensorValuesService/src-gen/SensorValues_operations.h
|
teco-kit/ModelDrivenGateways
|
97d661eab907e3b76ab96b4d86dd2e916088a1d8
|
[
"MIT"
] | null | null | null |
src/SensorValuesService/src-gen/SensorValues_operations.h
|
teco-kit/ModelDrivenGateways
|
97d661eab907e3b76ab96b4d86dd2e916088a1d8
|
[
"MIT"
] | 2 |
2021-03-23T08:05:15.000Z
|
2021-03-23T08:54:39.000Z
|
src/SensorValuesService/src-gen/SensorValues_operations.h
|
teco-kit/ModelDrivenGateways
|
97d661eab907e3b76ab96b4d86dd2e916088a1d8
|
[
"MIT"
] | null | null | null |
#ifndef SENSORVALUES_OPERATIONS_H
#define SENSORVALUES_OPERATIONS_H
enum SensorValues_operations {
OP_SensorValues_GetSensorValues,
OP_SensorValues_SensorValuesEvent,
OP_SensorValues_Config
};
#endif //SENSORVALUES_OPERATIONS_H
| 23.3 | 35 | 0.879828 |
6b9c387a499a96e02d99bf406107306a25cfd9c1
| 939 |
rs
|
Rust
|
twin-stick-shooter-core/src/test.rs
|
mvanbem/twin-stick-shooter
|
d4e21b2b994600fabd77cf619ec94ce53177f5d9
|
[
"MIT"
] | null | null | null |
twin-stick-shooter-core/src/test.rs
|
mvanbem/twin-stick-shooter
|
d4e21b2b994600fabd77cf619ec94ce53177f5d9
|
[
"MIT"
] | null | null | null |
twin-stick-shooter-core/src/test.rs
|
mvanbem/twin-stick-shooter
|
d4e21b2b994600fabd77cf619ec94ce53177f5d9
|
[
"MIT"
] | null | null | null |
use cgmath::{EuclideanSpace, InnerSpace};
use crate::physics::VelocityComponent;
use crate::position::PositionComponent;
#[derive(Clone, Debug)]
pub struct ReflectWithin(pub f32);
#[legion::system(for_each)]
pub fn reflect_within(
&PositionComponent(pos): &PositionComponent,
VelocityComponent(vel): &mut VelocityComponent,
&ReflectWithin(reflect_within): &ReflectWithin,
) {
// Check if the entity is outside the reflecting circle.
if pos.to_vec().magnitude() >= reflect_within {
// Check if the entity's velocity is outward.
let radial = vel.dot(pos.to_vec().normalize());
if radial > 0.0 {
// Reflect the entity's velocity inward by subtracting the radial component twice. Note
// that subtracting once would merely put its motion perpendicular to the reflecting
// circle.
*vel -= pos.to_vec().normalize_to(2.0 * radial);
}
}
}
| 34.777778 | 99 | 0.673056 |
b2effe0f8a82275a9712cccbfe5467301c5502b1
| 4,544 |
py
|
Python
|
src/title2Id_redirect_parser.py
|
mjstrobl/WEXEA
|
0af0be1cdb93fc00cd81f885aa15ef8d6579b304
|
[
"Apache-2.0"
] | 10 |
2020-06-14T15:46:53.000Z
|
2021-04-29T15:02:23.000Z
|
src/title2Id_redirect_parser.py
|
mjstrobl/WEXEA
|
0af0be1cdb93fc00cd81f885aa15ef8d6579b304
|
[
"Apache-2.0"
] | 3 |
2021-08-25T16:16:45.000Z
|
2022-02-10T04:29:10.000Z
|
src/title2Id_redirect_parser.py
|
mjstrobl/WEXEA
|
0af0be1cdb93fc00cd81f885aa15ef8d6579b304
|
[
"Apache-2.0"
] | 1 |
2021-02-17T17:44:06.000Z
|
2021-02-17T17:44:06.000Z
|
import xml.sax
import re
import os
import json
import time
current_milli_time = lambda: int(round(time.time() * 1000))
RE_LINKS = re.compile(r'\[{2}(.*?)\]{2}', re.DOTALL | re.UNICODE)
IGNORED_NAMESPACES = [
'wikipedia', 'category', 'file', 'portal', 'template',
'mediaWiki', 'user', 'help', 'book', 'draft', 'wikiProject',
'special', 'talk', 'image','module'
]
"""MediaWiki namespaces that ought to be ignored."""
class WikiHandler(xml.sax.ContentHandler):
def __init__(self,title2Id,id2Title,redirects):
self.tag = ""
self.content = ''
self.title = ''
self.id = -1
self.title2Id = title2Id
self.id2Title = id2Title
self.redirects = redirects
self.counter_all = 0
self.attributes = {}
self.n = 0
self.start = current_milli_time()
# Call when an element starts
def startElement(self, tag, attributes):
self.tag = tag
self.attributes = attributes
# Call when an elements ends
def endElement(self, tag):
if tag == 'title':
self.title = self.content.strip()
elif tag == 'id':
self.id = int(self.content)
if self.title not in self.title2Id:
self.title2Id[self.title] = self.id
self.id2Title[self.id] = self.title
self.counter_all += 1
if self.counter_all % 1000 == 0:
diff = current_milli_time() - self.start
print('Pages processed: ' + str(self.counter_all) + ', avg t: ' + str(diff / self.counter_all), end='\r')
elif tag == 'text':
self.n += 1
if not any(self.title.lower().startswith(ignore + ':') for ignore in IGNORED_NAMESPACES) and not self.title.lower().startswith('list of'):
self.processArticle()
elif tag == 'redirect' and 'title' in self.attributes:
redirect = self.attributes['title']
if not any(self.title.lower().startswith(ignore + ':') for ignore in IGNORED_NAMESPACES) \
and not any(redirect.lower().startswith(ignore + ':') for ignore in IGNORED_NAMESPACES) \
and not redirect.lower().startswith('list of') \
and not self.title.lower().startswith('list of'):
self.redirects[self.title] = redirect
self.content = ""
# Call when a character is read
def characters(self, content):
self.content += content
def processArticle(self):
text = self.content.strip()
#self.title2Id[self.title] = self.id
if text.lower().startswith('#redirect'):
match = re.search(RE_LINKS,text)
if match:
redirect = match.group(1).strip()
pos_bar = redirect.find('|')
if pos_bar > -1:
redirect = redirect[:pos_bar]
redirect = redirect.replace('_',' ')
if not any(redirect.lower().startswith(ignore + ':') for ignore in IGNORED_NAMESPACES) and not redirect.lower().startswith('list of'):
self.redirects[self.title] = redirect
else:
lines = text.split('\n')
for line in lines:
if not line.startswith('{{redirect|'):
break
else:
line = line[11:]
line = line[:line.find('|')]
if len(line) > 0:
if not any(line.lower().startswith(ignore + ':') for ignore in IGNORED_NAMESPACES) and not line.lower().startswith('list of'):
self.redirects[line] = self.title
if (__name__ == "__main__"):
title2Id = {}
id2Title = {}
redirects = {}
config = json.load(open('config/config.json'))
wikipath = config['wikipath']
outputpath = config['outputpath']
dictionarypath = outputpath + 'dictionaries/'
mode = 0o755
os.mkdir(outputpath, mode)
os.mkdir(dictionarypath, mode)
parser = xml.sax.make_parser()
parser.setFeature(xml.sax.handler.feature_namespaces, 0)
Handler = WikiHandler(title2Id,id2Title,redirects)
parser.setContentHandler(Handler)
parser.parse(wikipath)
print('done')
with open(dictionarypath + 'title2Id.json', 'w') as f:
json.dump(title2Id, f)
with open(dictionarypath + 'id2Title.json', 'w') as f:
json.dump(id2Title, f)
with open(dictionarypath + 'redirects.json', 'w') as f:
json.dump(redirects, f)
| 36.352 | 150 | 0.568442 |
9c382fa42ccb92b0e8c359ed8db1094d21087ec1
| 2,666 |
js
|
JavaScript
|
app/components/base_ui/StyledWrappers/styledComponents.js
|
mucyildiz/rysolv
|
f3f27d2856647649f102a21b8dbd77b4bd13c76a
|
[
"MIT"
] | null | null | null |
app/components/base_ui/StyledWrappers/styledComponents.js
|
mucyildiz/rysolv
|
f3f27d2856647649f102a21b8dbd77b4bd13c76a
|
[
"MIT"
] | null | null | null |
app/components/base_ui/StyledWrappers/styledComponents.js
|
mucyildiz/rysolv
|
f3f27d2856647649f102a21b8dbd77b4bd13c76a
|
[
"MIT"
] | null | null | null |
import styled from 'styled-components';
import {
defaultFontSize,
fundingClosedBackground,
fundingOpenBackground,
fundingText,
languageBackground,
languageText,
rewardBackground,
rewardColor,
} from 'defaultStyleHelper';
import { mediaQueriesByDevice } from 'utils/breakpoints';
const { mobile, mobileXXS } = mediaQueriesByDevice;
export const CircleOne = styled.div`
background: #ff6057;
border-radius: 50%;
height: 0.5rem;
margin-right: 0.3rem;
width: 0.5rem;
`;
export const CircleThree = styled.div`
background: #28ca43;
border-radius: 50%;
height: 0.5rem;
margin-right: 0.3rem;
width: 0.5rem;
`;
export const CircleTwo = styled.div`
background: #ffbe2f;
border-radius: 50%;
height: 0.5rem;
margin-right: 0.3rem;
width: 0.5rem;
`;
export const CircleWrapper = styled.div`
align-items: center;
display: flex;
height: 100%;
padding: 0 0.5rem;
`;
export const Image = styled.img`
border-bottom-left-radius: 0.5rem;
border-bottom-right-radius: 0.5rem;
height: auto;
width: 100%;
`;
export const ImageNavBar = styled.div`
background: #e8e8e8;
border-top-left-radius: 0.5rem;
border-top-right-radius: 0.5rem;
display: flex;
height: 1.5rem;
justify-content: space-between;
`;
export const Row = styled.div`
background: #b3b3b3;
border-radius: 0.2rem;
height: 0.2rem;
margin-bottom: 0.125rem;
width: 1rem;
`;
export const RowWrapper = styled.div`
align-self: center;
padding: 0 1rem;
`;
export const StyledImageWrapper = styled.div`
border-radius: 0.5rem;
box-shadow: 6px 28px 77px -24px rgba(0, 0, 0, 1);
height: fit-content;
max-width: 80rem;
width: 55%;
${mobile} {
width: 85%;
}
${mobileXXS} {
width: 95%;
}
`;
export const StyledFundingWrapper = styled.div`
background-color: ${({ open }) =>
open ? fundingOpenBackground : fundingClosedBackground};
border-radius: 0.25rem;
color: ${({ open }) => (open ? fundingText : '0')};
display: inline-flex;
font-size: ${({ medium }) => (medium ? '1.4rem' : 'inherit')};
font-weight: 700;
line-height: 2rem;
padding: 0.2rem 1rem;
white-space: nowrap;
`;
export const StyledLanguageWrapper = styled.div`
background-color: ${languageBackground};
border-radius: 0.25rem;
color: ${languageText};
display: inline-flex;
font-size: inherit;
margin: 0 0.5rem 0.5rem 0;
padding: 0.5rem;
`;
export const StyledRewardWrapper = styled.div`
align-self: center;
background: ${rewardBackground};
border-radius: 0.25rem;
color: ${rewardColor};
font-size: ${defaultFontSize};
font-weight: 700;
line-height: 2rem;
padding: 0.2rem 1rem;
white-space: nowrap;
`;
| 20.992126 | 64 | 0.68117 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.